ListBox - Row Source problem

  • Thread starter Thread starter unplugs
  • Start date Start date
U

unplugs

It seems quite difficult to get an answer here... Anyway, anothe
question from me.. :P


My userform has a combobox and listbox. So, can I do such that, whe
the user choose their username in the combobox, the listbox wil
display onli the entries that the user made? and not display othe
users' entries?


Is it possible to do so?

Any help would be appreciated.
;
 
If you double click on the combobox, you will be taken to the combobox's
change event code. In that procedure, you can then do something like:

Private Sub ComboBox1_Change()
Dim I As Integer
Dim J As Integer
Me.ListBox1.Clear
I = Me.ComboBox1.ListIndex
If I > -1 Then
'code that populates based on entry
'for example if the data is stored on a sheet
'named mydata
For J = 1 To 10
Me.ListBox1.AddItem Sheets("mydata").Cells(J, I + 1).Value
Next
End If
End Sub

Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
Thanks a lot Bob Flanagan.

and I realize 1 thing... that is the rowsource for listbox must be
open workbook... It can't refer to the close workbook.

:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top