input box, row locate

willsnake

New Member
Joined
Sep 9, 2014
Messages
41
Hi again,

I am here again seeking help...

What I am trying to accomplish is that, I wish to show an input box where I will input text or number, then a macro will locate the range and identify the row number, then there will be a code for that certain row. Then it will loop until there is no more text or number to locate...

Thnx in advance...
 
Since I haven't had a reply from you I've compile the following code:
Code:
PassRow()
Dim mySeek As Long
Dim a As Long
Dim lastrow As Long
Dim rowFound As Long
lastrow = Cells(Rows.Count, "C").End(xlUp).Row
mySeek = InputBox("Enter value to seek")
For a = 1 To lastrow
If Range("C" & a).Value = mySeek Then
Range("D" & a).Value = a
'rowFound = a
'NEWSUB
End If
Next
End Sub

I placed a small picture across the range of A1:B5 (or thereabouts).
I right-clicked the image and assigned the macro.

My data list was consecutive numbers. I went back and changed some so that I had replicated data.
When a replica was found its row number was recorded in D.
As you really don't want to see that value I've offered the variable rowFound which will then be passed to your next macro.
To use this for your purposes remove Range("D" & a).Value = a and the apostrophes that comment the next two rows.
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
BTW, about

For a = 1 To lastrow

is the last refers to the last row of an excel table, or the last row in excel which is 1,048,576?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

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