Determining Row Number

W

Wes Jester

I am having a bad time trying to get a row number into a variable. I am
missing something very basic in my understanding.

I have the following code

Dim iRow As Integer

Columns("A:A").Select

Selection.FindNext(After:=ActiveCell).Activate


I can get to the first row I am in interested in, but I need to save the
actual row number in a variable. My next action is to do another search
to find a row further along. I will then have the 2 row numbers to
develop a selection I need.



Wes

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
S

steve

Wes,

Your Find needs a What

Columns("A:A").Select
Selection.Find(What:="mywhat", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:= _
False).Activate
myrow = ActiveCell.Row

repeat for myrow2
 
T

Tom Ogilvy

Dim LngRow As Long

Columns("A:A").Select

' You need to do a find and specify what you are looking for before
' you do a findnext I believe.
Selection.FindNext(After:=ActiveCell).Activate

lngRow = ActiveCell.Row

When you are in VBA help looking at the Find method, you can look at the
code example for finding multiple instances (if you are using xl2000 or
xl97).

Regards,
Tom Ogilvy
 

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

Top