PC Review
Forums
Newsgroups
Microsoft Excel
Microsoft Excel Programming
relative reference in a macro to define a name
Forums
Newsgroups
Microsoft Excel
Microsoft Excel Programming
relative reference in a macro to define a name
![]() |
relative reference in a macro to define a name |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
Guest
Posts: n/a
|
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" <halforman@donotspamme.hotmail.com> wrote in message news:sYatc.23915$0X2.759557@twister.tampabay.rr.com... > 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 |
|
Guest
Posts: n/a
|
Thanks Bob, that worked, and saved me lots of time. I truly appreciate it.
Hal |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

