Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing variable values to userform control KJ-clueless Excel Discussion (Misc queries) 2 November 27th 07 10:51 PM
Control Combo Box Macros LoriDe Excel Discussion (Misc queries) 4 June 14th 07 06:51 PM
Passing Macros Between Workbooks Bernie Deitrick Excel Programming 1 June 30th 04 05:02 PM
Passing Execution Control Between Workbooks RSnyder[_2_] Excel Programming 0 May 7th 04 02:01 PM
passing value with button to macros pabs[_13_] Excel Programming 3 January 6th 04 05:10 PM


All times are GMT +1. The time now is 10:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"