View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jim May Jim May is offline
external usenet poster
 
Posts: 477
Default Starting at cell with string in VBA

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


" wrote:

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