Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2001-09-18
2
Medium Priority
?
211 Views
Last Modified: 2012-05-04
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
0
Comment
Question by:zoltix
  • 2
2 Comments
 
LVL 6

Expert Comment

by:OlegP
ID: 6489936
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
0
 
LVL 6

Accepted Solution

by:
OlegP earned 150 total points
ID: 6489937
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
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question