Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
object pointers
I'm new to VBA. I'm trying to make an object pointer so I can dynamically populate some ComboBoxes. Here is what doesn't work: Code: -------------------- Public Sub showForm() UserForm1.Show Sheet1.Activate For i = 1 To 4 a = "UserForm1.ComboBox" & i a.ColumnCount = 1 a.RowSource = "A2:A11" Next i End Sub -------------------- I've tryed switching data types with "as object" with no luck. Searching for this on the web is crazy. It seems everyone wants some pointers on using excel. :) -- rando4 ------------------------------------------------------------------------ rando4's Profile: http://www.excelforum.com/member.php...o&userid=28315 View this thread: http://www.excelforum.com/showthread...hreadid=478994 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
object pointers
Public Sub showForm()
Dim a as Object For i = 1 To 4 set a = Userform1.Controls("Combobox" & i) a.ColumnCount = 1 a.RowSource = "Sheet1!A2:A11" Next i UserForm1.Show End Sub -------------------- -- Regards, Tom Ogilvy "rando4" wrote in message ... I'm new to VBA. I'm trying to make an object pointer so I can dynamically populate some ComboBoxes. Here is what doesn't work: Code: -------------------- Public Sub showForm() UserForm1.Show Sheet1.Activate For i = 1 To 4 a = "UserForm1.ComboBox" & i a.ColumnCount = 1 a.RowSource = "A2:A11" Next i End Sub -------------------- I've tryed switching data types with "as object" with no luck. Searching for this on the web is crazy. It seems everyone wants some pointers on using excel. :) -- rando4 ------------------------------------------------------------------------ rando4's Profile: http://www.excelforum.com/member.php...o&userid=28315 View this thread: http://www.excelforum.com/showthread...hreadid=478994 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
object pointers
Hello Rando4, Neither Visual Basic nor Visual Basic for Applications use objec pointers in the traditional sense of a pointer. I have made the change to the code to do what you want. By the way, do you want all for ComboBoxes to be filled with the sam range data? Code ------------------- Public Sub showForm() Dim CB as Object UserForm1.Show Sheet1.Activate For i = 1 To 4 Set CB = UserForm1.Controls("ComboBox" & i) With CB .ColumnCount = 1 .RowSource = "Sheet1!$A$2:$A$11" End With Next i End Sub ------------------- Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=47899 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Mouse Pointers | Excel Discussion (Misc queries) | |||
need some pointers | New Users to Excel | |||
Pointers?? | Excel Programming | |||
Pointers?? | Excel Discussion (Misc queries) | |||
Pointers to appropriate functions | Excel Programming |