Display Multiple Column Data in Listbox based on Combo Box selection

aroig07

New Member
Joined
Feb 26, 2019
Messages
42
Hello !

I am trying to fill a multi-column ListBox based on a selection on a ComboBox (being populated through RowSource property). I am having an issue because the code works but is only showing the first row of data found and not all of them. I believe its because its not in a loop, but not sure how to attack it. Here is my code:

Private Sub ComboBox1_Change()

Dim cName As Range
Dim clName As Range
Dim jName As Variant

clName = ComboBox1.Value

With Worksheets("BOM Route")
Set cName = .Columns("A")
End With


Set clName = cName.Find(What:=jName, _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

If Not clName Is Nothing Then

ListBox1.AddItem

With ListBox1
.List(.ListCount - 1, 0) = clName.Offset(0, 1).Value 'Job Name B
.List(.ListCount - 1, 1) = clName.Offset(0, 8).Value 'Paper I
.List(.ListCount - 1, 2) = clName.Offset(0, 11).Value 'Envelope L
End With


Else
MsgBox jName & " not found in worksheet."
End If

End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

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