PDA

View Full Version : Fill ComboBox With Values From Corresponding Dynamic Column Based On Value Selected



paul_pearson
08-20-2013, 01:57 AM
What needs to be changed in the code so that the each combobox total list is available.When selecting Userform- Internal (category) the Comboxbox Part in the userform only has 9 entries so when i select Part No. and Fault it only shows also 9 entries but there are more on the list which are not available.Can each Combobox (Part,Part No.,Fault) be able to show all the items in there list

Thanks

Paul

Excel Fox
08-20-2013, 04:31 PM
Try this


Private Sub ComboBox3_Change()

Dim lngCol As Long
With Worksheets("sample")
lngCol = .Rows(2).Find(What:=Me.ComboBox3.Text, lookAt:=xlWhole).Column
Me.ComboBox4.List = .Range("A4:A" & .Cells(.Rows.Count, lngCol).End(xlUp).Row).Offset(, lngCol - 1).Value2
Me.ComboBox5.List = .Range("A4:A" & .Cells(.Rows.Count, lngCol + 1).End(xlUp).Row).Offset(, lngCol).Value2
Me.ComboBox6.List = .Range("A4:A" & .Cells(.Rows.Count, lngCol + 2).End(xlUp).Row).Offset(, lngCol + 1).Value2
End With

End Sub