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

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
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,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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