ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Rollover Define Name (https://www.excelbanter.com/excel-programming/353488-rollover-define-name.html)

Mr Cockles[_2_]

Rollover Define Name
 
Hi ,

I would like to add one, to the column of an original defined name, so as to
move the defined cell along one space, using the ActiveWorkbook.Names.Add
function. I'm trying to create a variable to get the original cell reference
and then just add one to the column reference, using the function above. How
do I do this?

Kind regards and thanks in advance

Jeff

Tom Ogilvy

Rollover Define Name
 
set rng = ActiveWorkbook.Names("MyName").RefersToRange
' now expand by one column
rng.Resize(,rng.columns.count+1).Name = "MyName"

'if you want to move the range over 1 columns

set rng = ActiveWorkbook.Names("MyName").RefersToRange
rng.offset(0,1).Name = "MyName"

--
Regards,
Tom Ogilvy

"Mr Cockles" wrote in message
...
Hi ,

I would like to add one, to the column of an original defined name, so as

to
move the defined cell along one space, using the ActiveWorkbook.Names.Add
function. I'm trying to create a variable to get the original cell

reference
and then just add one to the column reference, using the function above.

How
do I do this?

Kind regards and thanks in advance

Jeff




Mr Cockles[_2_]

Rollover Define Name
 
Thank you Tom. I'll have a try with this.

"Tom Ogilvy" wrote:

set rng = ActiveWorkbook.Names("MyName").RefersToRange
' now expand by one column
rng.Resize(,rng.columns.count+1).Name = "MyName"

'if you want to move the range over 1 columns

set rng = ActiveWorkbook.Names("MyName").RefersToRange
rng.offset(0,1).Name = "MyName"

--
Regards,
Tom Ogilvy

"Mr Cockles" wrote in message
...
Hi ,

I would like to add one, to the column of an original defined name, so as

to
move the defined cell along one space, using the ActiveWorkbook.Names.Add
function. I'm trying to create a variable to get the original cell

reference
and then just add one to the column reference, using the function above.

How
do I do this?

Kind regards and thanks in advance

Jeff






All times are GMT +1. The time now is 06:02 PM.

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