Combo and List box combination

A

Atif

Hi All,

Data is in following arrangement

Col A Col B
1 A B
2 A1 B1
3 A2 B2
4 A3

How can I populate a combo box with A and B (catagory), and display
corresponding values in a List Box.
 
G

galimi

Atif,

You have many options. The easiest way through this would be to combine the
values into a third column and use a Form combobox with a list range. You
could also do this programatically with a control combobox and combine the
values into one column or two.
 
P

Per Jessen

Hi

It can be done like this:

Private Sub ComboBox1_Click()
If Me.ComboBox1.Value = Range("A1").Value Then
Me.ListBox1.RowSource = "A2:A4"
ElseIf Me.ComboBox1.Value = Range("B1").Value Then
Me.ListBox1.RowSource = "B2:B4"
End If

End Sub
Private Sub UserForm_Initialize()
Me.ComboBox1.AddItem Range("A1").Value
Me.ComboBox1.AddItem Range("B1").Value
End Sub

Regards,
Per
 

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