Solved

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

Posted on 2001-09-18
2
184 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 50 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to hault or freeze parent form when a 2d form is open in vb6 3 43
Macro Excel - Multiple If conditions 2 87
vbModal 12 65
Send outlook email from VBS Script 2 58
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

685 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