Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just wondering if this is possible. I know the code I have writen so far
doesn't work but any idea's would be great. sub mysub() dim i as integer dim e as string e = 1 for i = 1 to 75 ComboBox & i.value = sheets("list").range("D"& e) e = e + 1 next i end sub -- Thanks! Shane W |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Controls("Combobox" & i).value= ....... "whylite" wrote: Just wondering if this is possible. I know the code I have writen so far doesn't work but any idea's would be great. sub mysub() dim i as integer dim e as string e = 1 for i = 1 to 75 ComboBox & i.value = sheets("list").range("D"& e) e = e + 1 next i end sub -- Thanks! Shane W |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() i think i know what you mean, but not certain 1st thought If you are just trying to add multiple values to a combobox use Code ------------------- sub mysub() dim i as integer dim e as string e = 1 for i = 1 to 75 ComboBox1.additem sheets("list").range("D"& e).value e = e + 1 next i end su ------------------- 2nd thought You are trying to loop though a number of different comboboxes Code ------------------- ' in the userform module Private Sub UserForm_Initialize() Dim obj As MSForms.Control, i As Long, c() As Class1 Range("a1").Select For Each obj In Me.Controls If TypeName(obj) = "ComboBox" Then ReDim Preserve c(i) Set c(i) = New Class1 c(i).SetComboBox obj obj.Tag = i End If Next obj End Sub 'create a class module and put this code in there Private WithEvents cb1 As MSForms.ComboBox Sub SetComboBox(ByVal cb As MSForms.ComboBox) Set cb1 = cb cb1.AddItem (ActiveCell.Value) ActiveCell.Offset(1, 0).Select End Su ------------------- this also gives you the option to use one change sub in the clas module for all the comboboxes g -- irishboy ----------------------------------------------------------------------- irishboyx's Profile: http://www.excelforum.com/member.php...fo&userid=3249 View this thread: http://www.excelforum.com/showthread.php?threadid=52303 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I add an integer to an existing integer? | Excel Worksheet Functions | |||
How do I make a graph with 2-cycle X 3-cycle log-log graph paper? | Charts and Charting in Excel | |||
How do I keep result from 1 iteration cycle to use in next cycle? | Excel Discussion (Misc queries) | |||
2 comboboxs, different sheet references | Excel Programming | |||
How do I create a button to reset ComboBoxs | Excel Programming |