Reputation: 2571
I have a drop down combobox. I would like the fields to be populated when I open the workbook; however, only the last chosen field is selectable, until the code is run.
How can I have the code run automatically when opening the workbook? Or is there an alternative way to do this?
The code that populates the combobox -when run- (which is written on the sheet which contains the combobox):
Sub UserForm_Initialize()
ComboBox1.List = Array("A", "B", "C", "D")
End Sub
Upvotes: 1
Views: 665
Reputation: 5174
Calling the procedure when the workbook opens will work like this:
Option Explicit
Private Sub Workbook_Open()
MyProcedure
End Sub
This code must be in the workbook object.
Upvotes: 2