Put your cursor on the word Add then hit F1
Select Excel Add
Then expand the item that reads "Add method as it applies to the Names
object."
I usually use RefersTo but it all depends on your goal.
..Add is a Function so it can return something.
The brackets are for syntax.
You dont use the brackets when there's nothing returning.
eg. .Add "MyName"
or
Set myname = .Add("MyName")
You dont need to return and store Name if you dont want to.
It's useful to store in a variable if you intend to work with it later in
the code.
--
Rob van Gelder -
http://www.vangelder.co.nz/excel
"Kevin H. Stecyk" wrote in message
...
Hi,
I am using XL 2003.
I am curious about adding a range name programmatically.
What I want to do is create a range name that is both local to the sheet
AND hidden.
Be careful with the word wrap.
ActiveWorkbook.Names.Add Name:="Sheet1!Blah", Visible:=False,
NameLocal:=True, RefersToR1C1Local:="=Sheet1!A25:B25"
It is now both local and hidden. So that works.
When I am typing this in, I see the prompts as:
Add([Name),[RefersTo],[Visible],[MacroType],[ShortcutKey],[Category],[NameLocal],
[RefersToLocal],[CategoryLocal],[RefersToR1C1],[RefersToR1C1]Local]) as
Name.
Questions:
1) Is there a description somewhere of the various parameters? I didn't
find much luck with the help file.
2) Am I correct to use "RefersToR1C1Local? And am I correct to use
"NameLocal:=True"? (It seems what makes the name local is
Name:="Sheet1!Blah"<.)
3) I note that is add([lots of parameters]) as Name. I think I could use
the parenthesis but then I would have to specify parameters in order? Is
that correct. I am trying to understand the difference between using and
not using parenthesis. This is a beginner question.
4) I note that as the very end, it has "as Name". I don't use that
anywhere. Should I be using somewhere.
Thank you.
Regards,
Kevin