Hi,
I can't seem to get my userform's combobox to correctly initialize the data range I'm inputting. I've inserted my code below. When I run the program I don't get any errors. However, the combobox only contains the first value and nothing else. Somehow the other values in my array are not being put into the data list for the box. Any ideas on what I should do?
Private Sub UserForm_Initialize()
'Set Range for RVArray
Dim RVvar As Integer
Sheets(1).Range("B5").Select
Selection.End(xlDown).Select
RVvar = ActiveCell.Row
'Get info for RVArray
Dim RowCounter As Integer
Dim RVArray() As String
ReDim RVArray(1 To RVvar)
RowCounter = 4
Counter = 1
For RowCounter = 5 To RVvar
RVArray(Counter) = Worksheets(1).Cells(RowCounter, 2).Value
Counter = Counter + 1
Next
RV_Sub_System_ComboBox.Column() = RVArray
'Combobox startup properties
RV_Sub_System_ComboBox.Style = fmStyleDropDownList
RV_Sub_System_ComboBox.BoundColumn = 0
RV_Sub_System_ComboBox.ListIndex = 0
End Sub
I can't seem to get my userform's combobox to correctly initialize the data range I'm inputting. I've inserted my code below. When I run the program I don't get any errors. However, the combobox only contains the first value and nothing else. Somehow the other values in my array are not being put into the data list for the box. Any ideas on what I should do?
Private Sub UserForm_Initialize()
'Set Range for RVArray
Dim RVvar As Integer
Sheets(1).Range("B5").Select
Selection.End(xlDown).Select
RVvar = ActiveCell.Row
'Get info for RVArray
Dim RowCounter As Integer
Dim RVArray() As String
ReDim RVArray(1 To RVvar)
RowCounter = 4
Counter = 1
For RowCounter = 5 To RVvar
RVArray(Counter) = Worksheets(1).Cells(RowCounter, 2).Value
Counter = Counter + 1
Next
RV_Sub_System_ComboBox.Column() = RVArray
'Combobox startup properties
RV_Sub_System_ComboBox.Style = fmStyleDropDownList
RV_Sub_System_ComboBox.BoundColumn = 0
RV_Sub_System_ComboBox.ListIndex = 0
End Sub