ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   edit range name (https://www.excelbanter.com/excel-programming/424940-edit-range-name.html)

MikeF[_2_]

edit range name
 
Should be simple, but just can't nail the syntax.

There is an existing Range Name "Variance".
Merely want whatever cell this line lands on ---
Range("xfd100").End(xlToLeft).Select
--- to become the new address of range name "Variance".

Here's one of a few dozen I've tried that don't work:

Range("xfd100").End(xlToLeft).Select
ActiveWorkbook.Names("Variance").RefersToRange.Sel ection

Thanx in advance for your assistance.

- Mike

FSt1

edit range name
 
hi
perhaps a small syntax problems....

Range("xfd100").End(xlToLeft).Select
ActiveWorkbook.Names.Add Name:="variance", RefersTo:=Selection

regards
FSt1

"MikeF" wrote:

Should be simple, but just can't nail the syntax.

There is an existing Range Name "Variance".
Merely want whatever cell this line lands on ---
Range("xfd100").End(xlToLeft).Select
--- to become the new address of range name "Variance".

Here's one of a few dozen I've tried that don't work:

Range("xfd100").End(xlToLeft).Select
ActiveWorkbook.Names("Variance").RefersToRange.Sel ection

Thanx in advance for your assistance.

- Mike


MikeF[_2_]

edit range name
 

The Add Name threw me off, thought it should be Edit Name.
But it works.
Thanx.

"FSt1" wrote:

hi
perhaps a small syntax problems....

Range("xfd100").End(xlToLeft).Select
ActiveWorkbook.Names.Add Name:="variance", RefersTo:=Selection

regards
FSt1

"MikeF" wrote:

Should be simple, but just can't nail the syntax.

There is an existing Range Name "Variance".
Merely want whatever cell this line lands on ---
Range("xfd100").End(xlToLeft).Select
--- to become the new address of range name "Variance".

Here's one of a few dozen I've tried that don't work:

Range("xfd100").End(xlToLeft).Select
ActiveWorkbook.Names("Variance").RefersToRange.Sel ection

Thanx in advance for your assistance.

- Mike


Dave Peterson

edit range name
 
I find this syntax easier:

Range("xfd100").End(xlToLeft).name = "variance"

If you wanted to use a worksheet level name:

With activesheet
.Range("xfd100").End(xlToLeft).name = "'" & .name & "'!variance"
end with

MikeF wrote:

Should be simple, but just can't nail the syntax.

There is an existing Range Name "Variance".
Merely want whatever cell this line lands on ---
Range("xfd100").End(xlToLeft).Select
--- to become the new address of range name "Variance".

Here's one of a few dozen I've tried that don't work:

Range("xfd100").End(xlToLeft).Select
ActiveWorkbook.Names("Variance").RefersToRange.Sel ection

Thanx in advance for your assistance.

- Mike


--

Dave Peterson


All times are GMT +1. The time now is 11:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com