PC Review


Reply
Thread Tools Rate Thread

relative reference in a macro to define a name

 
 
Hal Forman
Guest
Posts: n/a
 
      27th May 2004
I can't seem to get relative referencing to work. I found the toolbar with
Relative Referencing on it, but even when selected, the macro still has
absolute referencing!

Can anyone tell me what the code might look like to:

select the active cell
move end-down
move right 7 columns
define a name for the resulting range

Many thanks!


 
Reply With Quote
 
 
 
 
Bob Kilmer
Guest
Posts: n/a
 
      27th May 2004
Sub Main()
Dim nms As Names, i As Integer, r As Range

Set r = Range(ActiveCell.End(xlDown), ActiveCell.Offset(0, 7))
Call Names.Add("a_name", "=" & r.Address)

Set nms = ActiveWorkbook.Names
For i = 1 To nms.Count
Debug.Print nms(i).Name
Debug.Print nms(i).RefersToRange.Address
Next

End Sub


"Hal Forman" <(E-Mail Removed)> wrote in message
news:sYatc.23915$(E-Mail Removed)...
> I can't seem to get relative referencing to work. I found the toolbar

with
> Relative Referencing on it, but even when selected, the macro still has
> absolute referencing!
>
> Can anyone tell me what the code might look like to:
>
> select the active cell
> move end-down
> move right 7 columns
> define a name for the resulting range
>
> Many thanks!
>
>



 
Reply With Quote
 
Hal Forman
Guest
Posts: n/a
 
      28th May 2004
Thanks Bob, that worked, and saved me lots of time. I truly appreciate it.

Hal


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using relative reference in macro =?Utf-8?B?QmFz?= Microsoft Excel Misc 0 23rd Mar 2006 01:11 PM
Macro-Relative Reference Baldeagle Microsoft Excel Discussion 2 13th Jul 2005 06:56 PM
Relative reference in macro Ricki Miles Microsoft Excel Programming 3 23rd Jan 2005 09:51 PM
Macro - Relative Reference ajpowers Microsoft Excel Misc 2 3rd Jun 2004 05:51 PM
MACRO Relative Reference Ibrahim Awwad Microsoft Excel Programming 3 9th Sep 2003 03:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:07 AM.