Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing the Name of a Control Between Macros
I have a user form with a ComboBox
UserForm1.ComboBox1 I need to pass the control name to a macro and set the row source in the called macro. Sub SetRowSource(xControlName) ....... Code End Sub It's the ...... Code that has me confused. What should it be? I appreciate your help. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing the Name of a Control Between Macros
Private Sub Userform_Initialize()
SetRowSource me.Combobox1 End Sub Sub SetRowSource(xControlName as MSForms.Combobox) xControlName.RowSource = "Sheet1!A1:A20" End Sub -- Regards, Tom Ogilvy "Sandy" wrote in message ... I have a user form with a ComboBox UserForm1.ComboBox1 I need to pass the control name to a macro and set the row source in the called macro. Sub SetRowSource(xControlName) ...... Code End Sub It's the ...... Code that has me confused. What should it be? I appreciate your help. Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing the Name of a Control Between Macros
Hi,
Sub main() Dim ControlName As String MyControlName = "combobox1" Call SetRowSource(MyControlName) UserForm1.Show End Sub Sub SetRowSource(xControlName) UserForm1.Controls(xControlName).RowSource = "a1:a5" End Sub HTH "Sandy" wrote: I have a user form with a ComboBox UserForm1.ComboBox1 I need to pass the control name to a macro and set the row source in the called macro. Sub SetRowSource(xControlName) ...... Code End Sub It's the ...... Code that has me confused. What should it be? I appreciate your help. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing variable values to userform control | Excel Discussion (Misc queries) | |||
Control Combo Box Macros | Excel Discussion (Misc queries) | |||
Passing Macros Between Workbooks | Excel Programming | |||
Passing Execution Control Between Workbooks | Excel Programming | |||
passing value with button to macros | Excel Programming |