how to Capture a cell out of range of Listbox Selection and Fill in Other Listbox, or label on same userform

jdcar

Board Regular
Joined
Apr 27, 2012
Messages
163
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
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
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

jdcar

Board Regular
Joined
Apr 27, 2012
Messages
163
I forget
VBA Code:
Dim LastRow, x, CurVal As Range
Hi everyone
I have a userform, with a combobox, and from that I transfer data to a main worksheet(1)-(table),
but some especif data, depending on the kind of it, transfer as well to another worksheet(2).
This works well, but when I want to delete a especific data in determinate row in sheet1 it delete just in sheet 1 and didn't delete in worksheet2.
Are there any solution for this? How to use code vba to do that? Thank you
 

Watch MrExcel Video

Forum statistics

Threads
1,129,774
Messages
5,638,262
Members
417,018
Latest member
Khan kashaf

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
Top