First time poster on these forums, thanks for the help in advance!
Ultimately what I want to do is create a macro that decides how big a range is (it will always begin at B2), and set the combo box's input range as the said range. In this case, I've split the task into two methods, one that gets the range I want, and the other that sets up the combo box.
I am pretty confident the first method will work, but I keep getting a "Variable not defined" error for "ArmsDropDown" when I try to run the HICSInitialize macro. I've named the combo box on the worksheet "ArmsDropDown" (that is how it appears when selected). I am assuming that I'm neglecting to do something very obvious, since all the solutions I've found by searching are very straight-forward, but still fail for me.
Public Function HICSGetAllNamesFromWorksheet( _
sWorksheetName As String, _
Optional sCol As String = "B") As range
Dim iLowerBound As Integer
iLowerBound = _
Worksheets(sWorksheetName).range(sCol + "65536").End(xlUp).Row
HICSGetAllNamesFromWorksheet = _
Worksheets(sWorksheetName).range(sCol + "2:" + sCol + Format(iLowerBound))
End Function
Public Sub HICSInitialize()
ArmsDropDown.ListFillRange = _
HICSGetAllNamesFromWorksheet("Arms")
End Sub
As a side note, I am new to programming in VBA for excel, but not new to programming in general. If you can make any suggestions about how this can be done better or more efficiently, I'd like to learn.
Bookmarks