Link to home
Start Free TrialLog in
Avatar of zoltix
zoltix

asked on

vba: How to fill in combobox in excell from sheet ?

I have a sheet with a list of variables.   How can i fill in this combo box with necessary inforatmion because the number of item  can change with the time.
For example:


LOLO
LILI
LALA
[Empty]
[Empty]
......
......
......

I like have just LOLO LILI LALA
Avatar of OlegP
OlegP

Public Sub FillMy(ByRef cb As ComboBox, st As String)
Dim I As Long
Dim b As Long
Dim c As String
If (Len(RTrim(LTrim(st))) = 0) Then Exit Sub
Do
 st = LTrim(RTrim(st))
 b = InStr(1, st, " ")
 If (b <> 0) Then
    c = Mid(st, 1, b - 1)
    st = Mid(st, b, Len(st) - b + 1)
   Else
    c = st
 End If
 cb.AddItem c
Loop While b <> 0
End Sub
ASKER CERTIFIED SOLUTION
Avatar of OlegP
OlegP

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial