Prevost
Board Regular
- Joined
- Jan 23, 2014
- Messages
- 198
Hi Everybody. I am trying to call a public range to use as the data source for my combobox drop down list, however I continue to receive errors. I found some code that worked by declaring the range variable within the UserFrom_Initilialize() but I can't seem to transfer it over to what I would like. Also, what is going on with the Dim d(): d = myrange? Thanks!
This Works, but is not how I want my code set up.
This doesn't work, but is more like what I want, where I have declared myrange as a public variable in a module (and it is Sheet75.Range("A14:A16"))
This Works, but is not how I want my code set up.
Code:
Private Sub UserForm_Initialize()
Dim myrange As Range
Set myrange = Sheet75.Range("A14:A16")
Dim d(): d = myrange 'what is this line?
ComboBox1.List = d
End Sub
This doesn't work, but is more like what I want, where I have declared myrange as a public variable in a module (and it is Sheet75.Range("A14:A16"))
Code:
Private Sub UserForm_Initialize()
ComboBox1.List = myrange
End Sub