ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   naming a variable range (https://www.excelbanter.com/excel-programming/377721-naming-variable-range.html)

Nigel[_27_]

naming a variable range
 
why isnt this working?

Range("A" & UniqueDataStart & ":" & "A" & DataLast).Select
ActiveWorkbook.Names.Add Name:="S1", RefersTo:=Selection

i just want to named that range S1


Tom Ogilvy

naming a variable range
 
Why not use the easy method you were previously given:

Range("A" & UniqueDataStart & ":" & "A" & DataLast).Select

Selection.Name = "S1"

--
Regards,
Tom Ogilvy


"Nigel" wrote in message
oups.com...
why isnt this working?

Range("A" & UniqueDataStart & ":" & "A" & DataLast).Select
ActiveWorkbook.Names.Add Name:="S1", RefersTo:=Selection

i just want to named that range S1




Nigel[_27_]

naming a variable range
 
i get an error 400 with that....with either method actually.

On Nov 19, 4:28 pm, "Tom Ogilvy" wrote:
Why not use the easy method you were previously given:

Range("A" & UniqueDataStart & ":" & "A" & DataLast).Select

Selection.Name = "S1"

--
Regards,
Tom Ogilvy

"Nigel" wrote in ooglegroups.com...

why isnt this working?


Range("A" & UniqueDataStart & ":" & "A" & DataLast).Select
ActiveWorkbook.Names.Add Name:="S1", RefersTo:=Selection


i just want to named that range S1



Jim Cone

naming a variable range
 
I get error 450 or error 1004, but they all go away when I remove the
numeric digit from the name... Ss works.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Nigel"
wrote in message
i get an error 400 with that....with either method actually.



Tom Ogilvy

naming a variable range
 
Good catch Jim.


Missed that. A named range can not duplicate a Range Reference. S1 is a
valid range reference.

In otherwords, if you did Range("S1"), is is cell S1 or your named range (if
it could hold that name).

So S_1 would work. (just to emphasize that numbers are permitted although
not as the first character).

--
Regards,
Tom Ogilvy



"Jim Cone" wrote in message
...
I get error 450 or error 1004, but they all go away when I remove the
numeric digit from the name... Ss works.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Nigel"
wrote in message
i get an error 400 with that....with either method actually.






All times are GMT +1. The time now is 05:33 PM.

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