Range.Address: RelativeTo parameter

douglasH
StarLounger
Posts: 69
Joined: 10 Feb 2014, 19:30

Range.Address: RelativeTo parameter

Post by douglasH »

Excel 2007:

I was playing around with Range.Address. For what purposes would the parameter RelativeTo be used?

The following code returns "R[-1]C[-1]":

Code: Select all

Dim r As Range

Set r = Range("A1")

MsgBox r.Address(RowAbsolute:=False, ColumnAbsolute:=False, _
      ReferenceStyle:=xlR1C1, RelativeTo:=Range("B2"))
Thanks.

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Range.Address: RelativeTo parameter

Post by Rudi »

It provides the offset values for row and column to match the original reference.
As for it's purpose; I've never had the need for using it, so I'm not sure myself... :crazy:
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

douglasH
StarLounger
Posts: 69
Joined: 10 Feb 2014, 19:30

Re: Range.Address: RelativeTo parameter

Post by douglasH »

Thanks, Rudi... I guess it's just good to know RelativeTo is there if I ever need it.