Starting at cell with string in VBA

  • Thread starter Thread starter brett.kaplan
  • Start date Start date
B

brett.kaplan

Hi,

I want to create a macro that basically looks for a string in a certain
cell in column A, and then does some stuff starting in that row. How
can I define a variable to equal the row that has that string?

So, if I'm looking for the string "Period" in Column A, I want to
basically Find "Period" in A, and make the row number equal to myRow.

Thanks,
Brett
 
Someone can probably improve on this, but
it is the 1st time I have actually tried to write code
FROM MEMORY (that is without use of using Help,
Google, etc) There probably is more to it than I
have included below, error checking etc..
But I'm estactic that what I put together actually
WORKED!! -- Of course it only brings back the
First row number instance of "period".

Sub tester()
Set rng = Range("A:A")
With rng
Set c = .Find(What:="period")
myrow = c.Row
MsgBox "It is in Row number " & myrow
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top