return row number

jasmith

New Member
Joined
Oct 24, 2005
Messages
21
I have data in column one rows 3 thru 9
I am on row 3 and I want to stop at row 6

I have a macro as follows:
dim r as integer
do while r <> 3

activecell.next(2,0).select

r=Row(activecell)
loop

The point here is that I am unsure of my r=Row(activecell)
I thought that there was a function that would return the integer
value of the row of the active cell, but I could not find it.

Does anybody know how to return the row number?

Thanks in advance
 

Some videos you may like

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

jasmith

New Member
Joined
Oct 24, 2005
Messages
21
The above macro is flawed:

the code should read :

Do while r <> 6

Thanks!!!!!!
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hello, jasmith,
Does anybody know how to return the row number?
RowNumber = ActiveCell.Row

do you really need to select those cells ?
you can do operations without selecting cells
like this: Cells(1, 1) = 456

kind regards,
Erik
 

jasmith

New Member
Joined
Oct 24, 2005
Messages
21
THanks for the reply - - and I learned something new

I learned it this way from trial and error and just kept using the activecellmethod.- I did'nt know that
you could use the Cells method.

Thanks
 

Watch MrExcel Video

Forum statistics

Threads
1,118,079
Messages
5,570,083
Members
412,310
Latest member
mark884
Top