In Excel there's a combobox that needs to be populated with data from a worksheet (A1->A24). A FOR loop seemed the most obvious way to do it, but when the code runs the compiler spits out an "Invalid Argument" error but doesn't highlight any specific piece of code.
Once this is working the next step will be to populate a second combobox (ComboBox2) with data (A2->A5, or B2->B5, or C2->C3, etc) based on the selection from the first (ComboBox1). Any ideas as to how this can be accomplished? Any help would be greatly appreciated.
----------------------------------------
If you are reading this, then you have read too far...
Code:
Dim MySheet as Worksheet
Set MySheet = Worksheets("Sheet2")
For i = 1 To 24
ComboBox1.AddItem MySheet.Range("A1").Offset(i - 1).Value, i
Next i
Once this is working the next step will be to populate a second combobox (ComboBox2) with data (A2->A5, or B2->B5, or C2->C3, etc) based on the selection from the first (ComboBox1). Any ideas as to how this can be accomplished? Any help would be greatly appreciated.
----------------------------------------
If you are reading this, then you have read too far...