Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable Naming Convention Ben Excel Programming 0 April 8th 06 08:48 AM
Naming a worksheet as a variable in a Active Chart Series Farooq Sheri Excel Programming 5 January 26th 06 08:00 AM
VB Code Naming a Range (range changes each time) krazylain Excel Programming 4 May 15th 04 12:41 PM
Naming a range cornishbloke[_5_] Excel Programming 1 December 15th 03 02:28 PM
Naming a variable in a file path Ron[_13_] Excel Programming 1 October 19th 03 02:56 AM


All times are GMT +1. The time now is 01:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"