gringo287
07-14-2012, 12:12 PM
Hi,
I received some awesome help yesterday from CodeNinja and not sure if i would be breaking the forum rules if i were to re open a solved thread, so i thought id better start a new one. Pretty sure im missing something simple.
I have Four sheets that visually will look idnetical but will all have different options within a combobox. Ive essentally duplicated CodeNinjas code and made my best attempt at looping (without any idea if its even possible in workbook_open) it to produce the desired lists on the individual sheets. im not getting any errors, but only Combobox1 is working?
Private Sub Workbook_Open()
Dim l As Long
Dim s As String
For l = 40 To Sheet1.Range("B65536").End(xlUp).Row
s = Sheet1.Cells(l, 1)
Sheet1.ComboBox1.AddItem (s)
Next
For l = 40 To Sheet5.Range("B65536").End(xlUp).Row
s = Sheet5.Cells(l, 1)
Sheet5.ComboBox2.AddItem (s)
Exit For
Next
For l = 40 To Sheet6.Range("B65536").End(xlUp).Row
s = Sheet6.Cells(l, 1)
Sheet6.ComboBox3.AddItem (s)
Exit For
Next
For l = 40 To Sheet7.Range("B65536").End(xlUp).Row
s = Sheet7.Cells(l, 1)
Sheet7.ComboBox4.AddItem (s)
Exit For
Next
End Sub
I received some awesome help yesterday from CodeNinja and not sure if i would be breaking the forum rules if i were to re open a solved thread, so i thought id better start a new one. Pretty sure im missing something simple.
I have Four sheets that visually will look idnetical but will all have different options within a combobox. Ive essentally duplicated CodeNinjas code and made my best attempt at looping (without any idea if its even possible in workbook_open) it to produce the desired lists on the individual sheets. im not getting any errors, but only Combobox1 is working?
Private Sub Workbook_Open()
Dim l As Long
Dim s As String
For l = 40 To Sheet1.Range("B65536").End(xlUp).Row
s = Sheet1.Cells(l, 1)
Sheet1.ComboBox1.AddItem (s)
Next
For l = 40 To Sheet5.Range("B65536").End(xlUp).Row
s = Sheet5.Cells(l, 1)
Sheet5.ComboBox2.AddItem (s)
Exit For
Next
For l = 40 To Sheet6.Range("B65536").End(xlUp).Row
s = Sheet6.Cells(l, 1)
Sheet6.ComboBox3.AddItem (s)
Exit For
Next
For l = 40 To Sheet7.Range("B65536").End(xlUp).Row
s = Sheet7.Cells(l, 1)
Sheet7.ComboBox4.AddItem (s)
Exit For
Next
End Sub