Search in workbook using row number

obaid_457

New Member
Joined
Jul 27, 2017
Messages
6
this is my first post here an i am very beginner of excel vba

my question is

i have a userform with
textbox1
textbox2
textbox3
and CommandButton1

in my excel sheet in first colam i have numbers
if the data i type in textbox1 in cell "A" it shows the result of Cell "b" in textbox2. that is ok i can
with this code

Code:
Private Sub CommandButton1_Click()TextBox2.Text = Clear
TextBox3.Text = Clear
Dim apple As Long
Dim test As Long
apple = Sheets("sheet1").Range("a" & Rows.Count).End(xlUp).Row
For test = 1 To apple
If Sheets("sheet1").Cells(test, 1).Text = TextBox1.Value Then
TextBox2.Text = Sheets("sheet1").Cells(test, 2)
End If
Next test
End Sub


i want that it show the row number in TextBox3
is that Possible?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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