#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default range names

Hi

y does the code......
selection.name=range("A1").text
return an error....

"this name is not valid"
please help!!!!!!!!!!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default range names

Because - the name is not valid. As an experiment I created a
spreadsheet with the text "Bob" in A1 then wrote a sub with your line
of code and it executed with no problem at all - so the problem must
lie with the actual text in A1. I think that the rules are that it
shouldn't have anything other than letters, underscores and numbers,
shouldn't be confusable with a cell address and shouldn't start with a
number. What do you have in A1?

Zaahir wrote:
Hi

y does the code......
selection.name=range("A1").text
return an error....

"this name is not valid"
please help!!!!!!!!!!!!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default range names

One more thought - note that when you use Insert - Names - Create to
create a name, Excel automatically replaces spaces with underscores.
You can do this in VBA:

Selection.Name = Replace(Trim(Range("A1").Text), " ", "_")

HTH

-John Coleman

John Coleman wrote:
Because - the name is not valid. As an experiment I created a
spreadsheet with the text "Bob" in A1 then wrote a sub with your line
of code and it executed with no problem at all - so the problem must
lie with the actual text in A1. I think that the rules are that it
shouldn't have anything other than letters, underscores and numbers,
shouldn't be confusable with a cell address and shouldn't start with a
number. What do you have in A1?

Zaahir wrote:
Hi

y does the code......
selection.name=range("A1").text
return an error....

"this name is not valid"
please help!!!!!!!!!!!!


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
converting email address names in a range of cells to real names John Excel Worksheet Functions 1 May 19th 10 03:44 PM
How to Delete blanks between a range and populate only the names inthe given range Yuvraj Excel Discussion (Misc queries) 2 November 4th 09 08:32 PM
COPYING FORMULA CONTAINING NAMES/RELATIVE RANGE NAMES Bricol Excel Discussion (Misc queries) 0 July 8th 08 03:54 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Range Names-VBA JohnUK Excel Programming 4 April 20th 05 03:07 PM


All times are GMT +1. The time now is 03:56 PM.

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

About Us

"It's about Microsoft Excel"