I want to add unique data (From MainMenuData worksheet in same workbook) into ActiveX combo box placed on sheet1. Changed ComboBox Name from Properties to ZoneDropDown
. Wrote following code on workbook open event.
Private Sub workbook_open()
Dim Zn()
Dim R As Integer
For R = 1 To 248
ZoneDropDown.AddItem Sheets("MainMenuData").Cells(R, 7)
Next
End Sub
It gives following error for ZoneDropDown
Microsoft Visual Basic for Applications
Compile error:Variable not defined
But if I place button on same worksheet (i.e. sheet1) above code execute successfully and data added into combo box.
Dim Zn()
as anything (integer, string, etc.). What is it for? If you remark it out, does the code work?