PDA

View Full Version : Combobox



ed raket
09-19-2010, 09:55 AM
I have 3 linked comboboxes.
The selection in combobox 1 generates a list for combobox 2.
The selection in combobox must generate a list which is generated bij the vlookup function. The problem is that the list in combobox 3 always gives the list linked to the first item from the list in combobox 2.
The code looks like this:

Private Sub NLFSBCode_Change()
Dim strRange, strRange1, zoek As String
If NLFSBCode.ListIndex > -1 Then
strRange = NLFSBCode
strRange1 = Onderdeel


strRange = Replace(strRange, " ", "_")
With Onderdeel
.RowSource = vbNullString
.RowSource = "'D:\[werkmap2.xls]Testmap'!" & strRange
.ListIndex = 0
End With
strRange1 = Replace(strRange1, " ", "_")

With Gebrek1
Dim Range_Lookup As Range
Dim lookup_row_value As String
Dim found_value As Variant
lookup_row_value = Onderdeel
Set Range_Lookup _
= Workbooks("Werkmap2.xls").Worksheets("Testmap").Range("$C$2:$E$920")
found_value = Application.VLookup(lookup_row_value, Range_Lookup, 3, False)


.RowSource = vbNullString
.RowSource = "'D:\[werkmap2.xls]Gebrekenlijst'!" & found_value
.ListIndex = 0
End With

Bob Phillips
09-19-2010, 11:50 AM
Bit sparse on details. What is Onderdeel for instance?

How about the workbook(s)?