View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default 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.