View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Offset Method and Interpreting Absolutes in Range Objects

Depends on what you ask for.
? activeCell.Address(0,0)
C7
? activecell.Address(0,0,xlA1,true)
[Book1]Sheet1!C7


However, VBA pays no attention to absolute and relative notation in working
with arguments to ranges.

It is unclear what the Monkey expects to happen.

Perhaps this:

Suspectedrng= "$A7"
Set r = Range(Suspectedrng)
RevisedRngRight = r.Offset(0, 1).Address(0,1)
? revisedrngright
$B7

--
Regards,
Tom Ogilvy



"JNW" wrote in message
...
To my knowledge, the address command always returns absolute ranges. You
could test this by removing the $ before the A and trying again.

Depending on what you are doing a fill command may work better. Would

need
more information though.

JNW

"ExcelMonkey" wrote:

I have the following code below which offsets a cell range. Two

questions:

1) Why is the row (7) absoluted in the revised range?
2) The Offset does not appear to recognize the fact that the cell $A7

has
its column absoluted therefore it increments this to column "B". Why is

this
(aside from the fact that I told it to do it (0,1)? Is there a way of

using
the Offset Method to have it interpret absolutes properly?

Thanks


Suspectedrng= "$A7"
Set r = Range(Suspectedrng)
RevisedRngRight = r.Offset(0, 1).Address

?RevisedRngRight
$B$7