Solved

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

Posted on 2001-09-18
2
188 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

710 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