I have an Excel worksheet ("RLD" containing a combobox which I want to populate with a range of values in a second worksheet ("DATA". I have the code to do this, as follows:
RLD.lstSubject.Clear
For i = 2 To c - 1
RLD.lstSubject.AddItem Worksheets("DATA".Cells(i, 1).Value
Next i
Here, RLD is the name of the main worksheet and lstSubject is the list I want to populate. c is the value of the first row that does not contain data, i.e. the end of the list.
This works fine, but I have to manually populate it when the worksheet is loaded. How can I get Excel to populate the values automatically when the workbook is opened?
I've tried the above function in the Workbook_Open sub, but it doesn't seem to work.
Anybody?
RLD.lstSubject.Clear
For i = 2 To c - 1
RLD.lstSubject.AddItem Worksheets("DATA".Cells(i, 1).Value
Next i
Here, RLD is the name of the main worksheet and lstSubject is the list I want to populate. c is the value of the first row that does not contain data, i.e. the end of the list.
This works fine, but I have to manually populate it when the worksheet is loaded. How can I get Excel to populate the values automatically when the workbook is opened?
I've tried the above function in the Workbook_Open sub, but it doesn't seem to work.
Anybody?