Combobox - Problem on AddItem
Try this and see if it loads the Combobox.
Private Sub UserForm_Initialize()
Dim i As Long, v As Variant
Dim rng As Range, lr As Long
lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
Set rng = ActiveSheet.Range("A5:A" * lr)
ReDim v(0 To rng.Count - 1, 0 To 1)
i = -1
For Each c In rng
i = i + 1
v(i, 0) = c.Text
v(i, 1) = c.Offset(,1).Text
Next
Combobox1.ColumnCount = 2
Combobox1.List = v
Combobox1.BoundColumn = 0
End Sub
"Eddie_SP" wrote in message
...
I tried this:
Private Sub UserForm_Initialize()
Dim i As Integer
Dim ComboRange As Range
i = 5
While (ActiveSheet.Cells(1 + i, 11) < 0)
i = i + 1
If Cells(1 + i, 11).Text < "OK" And Cells(1 + i, 11).Text < ""
Then
ComboRange = Range("A" & i & ":B" & i)
With ComboBox1
.ColumnWidths = "50;80"
.AddItem ComboRange
End With
End If
Wend
End Sub
But it doesn't work...
=(
|