V
Valeria
Dear Experts,
I am trying to populate a combobox in a userform with data looked up from a
worksheet. Here is the code:
Private Sub Userform_Initialize()
Dim rng As Range
Dim End_Row As Integer
Dim Begin_Row As Integer
Dim i As Integer
i = 0
Do
i = i + 1
Loop Until Worksheets("Data").Cells(i, 1) = Worksheets("Choix").Cells(4, 1)
Begin_Row = i
Do
i = i + 1
Loop Until Worksheets("Data").Cells(i, 1) <> Worksheets("Choix").Cells(4, 1)
End_Row = i - 1
Set rng = Range((Worksheets("Data").Range("B", Begin_Row)),
Worksheets("Data").Range("B", End_Row))
Me.ComboBox1.List = rng.Value
End Sub
However I always get an error when I get to "set rng".
Can you please help me? I am using excel 2003.
Thanks!
Kind regards
I am trying to populate a combobox in a userform with data looked up from a
worksheet. Here is the code:
Private Sub Userform_Initialize()
Dim rng As Range
Dim End_Row As Integer
Dim Begin_Row As Integer
Dim i As Integer
i = 0
Do
i = i + 1
Loop Until Worksheets("Data").Cells(i, 1) = Worksheets("Choix").Cells(4, 1)
Begin_Row = i
Do
i = i + 1
Loop Until Worksheets("Data").Cells(i, 1) <> Worksheets("Choix").Cells(4, 1)
End_Row = i - 1
Set rng = Range((Worksheets("Data").Range("B", Begin_Row)),
Worksheets("Data").Range("B", End_Row))
Me.ComboBox1.List = rng.Value
End Sub
However I always get an error when I get to "set rng".
Can you please help me? I am using excel 2003.
Thanks!
Kind regards