I am trying to write some code that will put information in to a combobox (Column A). I keep gettin a Subscript out of range error and I can't see the problem. I'm too new to know when I mess something up. Can anyone please tell me where my error is?
I would appreciate any help given.
Private Sub UserForm_Initialize()
Dim listitems As Variant
Dim mysource As Workbook
Dim i As Integer
Dim lastrow As Double
lastrow = Rows.Cells(65536, 1).End(xlUp).Row
Set mysource = ActiveWorkbook
listitems = mysource.Worksheets(1).Range(Cells(1, 1), Cells(lastrow, 1)).Value
With Me.ComboBox1
.Clear
For i = 1 To UBound(listitems)
.AddItem listitems(i)
Next i
End With
End Sub
For just $19.95 you too can have a beautiful smile.
I would appreciate any help given.
Private Sub UserForm_Initialize()
Dim listitems As Variant
Dim mysource As Workbook
Dim i As Integer
Dim lastrow As Double
lastrow = Rows.Cells(65536, 1).End(xlUp).Row
Set mysource = ActiveWorkbook
listitems = mysource.Worksheets(1).Range(Cells(1, 1), Cells(lastrow, 1)).Value
With Me.ComboBox1
.Clear
For i = 1 To UBound(listitems)
.AddItem listitems(i)
Next i
End With
End Sub
For just $19.95 you too can have a beautiful smile.