Hi All,
I'm a newbie to VBA so maybe this is a simple question, but I can’t figure out how to concatenate 3 textboxes with a VLookup result value coming from an external worksheet with a named range called "Lookup".
The Vlookup search value is entered in a Listbox ( SelectFw) which is used to search for the answer in column 3 , 4 and 5 of the external worksheet.
The found value will populate my 3 textboxes, but if i select my next "listbox" value the current value of the textboxes will be overwritten.
I tried to loop through Vlookup and use concatenate to combine the result values but this isn’t working at all.
I think I’m on the wrong track here so can anyone point me in the right direction??
The code below is the code I use, which gives only one result.
many thanks in advance
I'm a newbie to VBA so maybe this is a simple question, but I can’t figure out how to concatenate 3 textboxes with a VLookup result value coming from an external worksheet with a named range called "Lookup".
The Vlookup search value is entered in a Listbox ( SelectFw) which is used to search for the answer in column 3 , 4 and 5 of the external worksheet.
The found value will populate my 3 textboxes, but if i select my next "listbox" value the current value of the textboxes will be overwritten.
I tried to loop through Vlookup and use concatenate to combine the result values but this isn’t working at all.
I think I’m on the wrong track here so can anyone point me in the right direction??
The code below is the code I use, which gives only one result.
many thanks in advance
Code:
Private Sub CalenderLabel_Click()
Dim i As Integer
Dim j As Integer
Dim arrItems() As String
ReDim arrItems(0 To SelectFw.ColumnCount - 1)
For j = 0 To SelectFw.ListCount - 1
If SelectFw.Selected(j) Then
For i = 0 To SelectFw.ColumnCount - 1
arrItems(i) = SelectFw.Column(i, j)
'Lookup values based on SelectFw
With Me
.Reg3 = Application.WorksheetFunction.VLookup((Me.SelectFw.Column(i, j)), Range("Lookup"), 3, 0)
.Reg4 = Application.WorksheetFunction.VLookup((Me.SelectFw.Column(i, j)), Range("Lookup"), 4, 0)
.Reg6 = Application.WorksheetFunction.VLookup((Me.SelectFw.Column(i, j)), Range("Lookup"), 6, 0)
End With
Next i
End If
Next j
End Sub