listbox add item

mrowe

Board Regular
Joined
Feb 17, 2002
Messages
232
Hi there,

Looking for help on a custome user form.

Have a drop down controll that with 3 values hard coded in (ie JAX,TIZ,OAP)

Based on the selected item from the above code, I want to fill a list box with associated items (from a range with in the workbook ie sheet1 A1:B10-A1:A10 being one of the 3 hard coded items, b1:b10 being the related items.

I've tried ListBox1.AddItem from the help files, but seem to be getting no where fast.

Any clues on this one?
Thanks in advance
Matt
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Try this:

Code:
Private Sub ComboBox1_Change()
    Dim c As Range
    ListBox1.Clear
    For Each c In Worksheets("Sheet1").Range("A1:A10")
        If c.Value = ComboBox1.Value Then
            ListBox1.AddItem c.Offset(0, 1).Value
        End If
    Next c
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,528
Messages
6,120,065
Members
448,942
Latest member
sharmarick

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top