inactiveUser214710
Board Regular
- Joined
- Apr 27, 2012
- Messages
- 171
Hi everyone
I have a listbox on my userform where I select a row.
The data comes from sheet1
This sheet have several columns(10) and that listbox show only the first 4 columns, and this is what I want.
I would like to show on other listbox or in a label, at same userform, the line corresponding to the selected in the listbox, but of the 10th column.
Will be possible?
I tried with the code bellow, but wihtout any result, because It shows all data from that column(k).
Thank you very much
I have a listbox on my userform where I select a row.
The data comes from sheet1
This sheet have several columns(10) and that listbox show only the first 4 columns, and this is what I want.
I would like to show on other listbox or in a label, at same userform, the line corresponding to the selected in the listbox, but of the 10th column.
Will be possible?
I tried with the code bellow, but wihtout any result, because It shows all data from that column(k).
Thank you very much
VBA Code:
'''find the lastrow 'Data begin column B and goes until k
LastRow = Sheet1.cells(Rows.Count, 2).End(xlUp).Row
'''clear listbox4
Me.ListBox4.Clear
CurVal = Me.ListBox1.Value '''''ListBox1.List(ListBox1.ListIndex, i) 'Me.ListBox1.Value
''
For x = 2 To LastRow
If Sheet1.cells(x, "b") = CurVal Then
'found a match populate listbox4
Me.ListBox4.AddItem Sheet1.cells(x, "k")
End If
Next x