Relative moving the active row in a macro


Posted by Phil J on December 21, 2001 1:03 PM

I'd like to move and select the active row in a relative manner
within a macro.

For example, if my active row is on row X,
then I'd like to reset the active row to row X-3.

I've tried using the Rows(" : ") function, but it
dowsn't seem to take R1:C1 notation in a text argument.
removing quotes to something like Rows(R[-3]:R[-3])
doesn't work either.

I may want to do range selects in the same manner as
well if there's a similar issue.

Many thanks in advance for your help.



Posted by Ivan F Moala on December 21, 2001 1:10 PM

Have a look @ online help for Offset
In your example

if youe active row was selected as

Range("C2").select then selecting relative to this
BUT 3 rows down would be

Range("C2").Offset(3,0) where 3 is the row offset
relative to C2 and 0 = Column offset

Look @ Help files


Ivan