Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default relative reference in a macro to define a name

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!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default relative reference in a macro to define a name

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" wrote in message
m...
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!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default relative reference in a macro to define a name

Thanks Bob, that worked, and saved me lots of time. I truly appreciate it.

Hal


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro relative cell reference decimal Excel Worksheet Functions 3 May 21st 09 11:36 PM
Relative reference? in macro TRYING Excel Worksheet Functions 3 November 20th 07 12:00 AM
Using relative reference in macro Bas Excel Discussion (Misc queries) 0 March 23rd 06 12:11 PM
Recording a macro with relative reference Shilps Excel Programming 1 April 5th 04 09:16 AM
MACRO Relative Reference Ibrahim Awwad Excel Programming 3 September 9th 03 02:11 PM


All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"