PDA

View Full Version : [SOLVED] ListBox1_Click to select an item on a worksheet



simora
03-07-2017, 12:10 PM
I'm currently populating a Listbox in a userform like this:



With ListBox1
.AddItem rngFind.Address ' Cell Address
.List(.ListCount - 1, 1) = (Cells(loc, 1)) ' First Column of found row
.List(.ListCount - 1, 2) = (Cells(1, Col))

End With


rngFind.Address is the result of a search in the UserForm

How can I select the rngFind.Address on Sheet1 when the user clicks that listbox item in the Userform ?

It needs to go into the Private Sub ListBox1_Click() Module.

Thanks

SamT
03-07-2017, 01:49 PM
Sheets("Sheet1").Range(Me.ListBox1.Value).Select

simora
03-07-2017, 03:38 PM
SamT (http://www.vbaexpress.com/forum/member.php?6494-SamT):

I looked at this and wondered why my version DID NOT WORK.
I was accessing the wrong worksheet among other things. Duhhhhh!
Your version worked great as expected.
Thanks

SamT
03-07-2017, 08:38 PM
:beerchug: