Populate List / Combo Box

G

Guest

I want to populate a list box with filtered values from column y based on the
value in column x matching the value in cell a1.

Column y contains a list of players.
Column x contains the team to which the player belongs
A1 will be updated by the user with the team name
The list box will then display the players who are members of the team in A1

I'd be grateful for suggestions how to acheive the filtering rather than
populating the list box with all column y values and therefore displaying
all players irrespective of their team.

Thanks in advance,

David
 
J

Jim Rech

You might do something like this:

Sub PopListbox()
Dim Cell As Range
For Each Cell In Range("X1:X20")
If Cell.Value = Range("A1").Value Then
Sheet1.ComboBox1.AddItem Cell.Offset(0, 1).Value
End If
Next
End Sub

--
Jim
|I want to populate a list box with filtered values from column y based on
the
| value in column x matching the value in cell a1.
|
| Column y contains a list of players.
| Column x contains the team to which the player belongs
| A1 will be updated by the user with the team name
| The list box will then display the players who are members of the team in
A1
|
| I'd be grateful for suggestions how to acheive the filtering rather than
| populating the list box with all column y values and therefore
displaying
| all players irrespective of their team.
|
| Thanks in advance,
|
| David
 

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

Top