M
Mark Stephens
Hi there,
This is a strange one ...
I have a requirement to name a fairly large range of cells and so wish to automate the process.
As I usually do I recorded a macro to see how it works and came up with the following code which name the required range no problem:
ActiveWorkbook.Names.Add Name:="May_13_GBP", RefersToR1C1:= "='BY MONTH'!R24C2"
In order automate it I need to pick up the name of the range from another two cells by concatenating their contents so I came up with the following code:
sName = Format(Cells(22, b + 1), "mmm yy") & "_" & Range("A24").Value
ActiveWorkbook.Names.Add Name:=sName, RefersToR1C1:="='BY MONTH'!R24C2"
The string in the second example is identical to the string in the first, so why wouldn't it work???
I am at a loss it just doesn't make any sense, it should work fine.
Anyone have any idea what I am missing here?
Thanks and regards, Mark
This is a strange one ...
I have a requirement to name a fairly large range of cells and so wish to automate the process.
As I usually do I recorded a macro to see how it works and came up with the following code which name the required range no problem:
ActiveWorkbook.Names.Add Name:="May_13_GBP", RefersToR1C1:= "='BY MONTH'!R24C2"
In order automate it I need to pick up the name of the range from another two cells by concatenating their contents so I came up with the following code:
sName = Format(Cells(22, b + 1), "mmm yy") & "_" & Range("A24").Value
ActiveWorkbook.Names.Add Name:=sName, RefersToR1C1:="='BY MONTH'!R24C2"
The string in the second example is identical to the string in the first, so why wouldn't it work???
I am at a loss it just doesn't make any sense, it should work fine.
Anyone have any idea what I am missing here?
Thanks and regards, Mark