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!!!!!!!!!!!!
|