Enter row number in listbox1 when value on worksheet found

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,731
Office Version
  1. 2007
Platform
  1. Windows
I am using the code below

On my userform i type in Textbox1 a value.
The code then looks for that value on my worksheet.
IAs each value is found i would like to have the row number put into listbox1

Please advise how we can this this.
Thanks


Rich (BB code):
Private Sub FindTheValue_Click()
If TextBox1.Value = "" Then
  MsgBox "PLEASE TYPE A VALUE TO SEARCH FOR", vbCritical + vbOKOnly, "SEARCH BOX IS EMPTY"
  TextBox1.SetFocus
  
  Else
    Set Rng = ws.Range("A5:AB3000").Find(Me.TextBox1.Value, Rng) ' RANGE TO LOOK IN & TEXTBOX NAME FOR WHAT TO LOOK FOR
    If Not Rng Is Nothing Then
        ws.Activate
        Rng.Select
    Else
        MsgBox "NOTHING TO MATCH THE SEARCH VALUE", vbCritical, "VALUE NOT FOUND MESSAGE"
        Exit Sub
    End If
    End If
End Sub
 
Now sorted.

I see we had WHOLE & i didnt spot it so only typing some of a value to search>

Now off to see how to click listbox number & go to it

Thanks
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,223,877
Messages
6,175,137
Members
452,614
Latest member
MRSWIN2709

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
Back
Top