vba equivalents of set.name and define.name

  • Thread starter Thread starter John Smith
  • Start date Start date
J

John Smith

I'm converting an old xlm file to vba. What are the vba
equivalents of set.name and define.name? Thanks.
 
These refer to Defined Names within Excel, which in the product is created
via menu

Insert>Name>Define ...

and provide the name, and the RefersTo value.

In VBA that can be done by building the name, and then assigning a value to
the range

ActiveWorkbook.Names.Add Name:="Bob", RefersTo:=Range("A1")
Range("Bob").Value = 123

A simpler way of defing the name is from a range

Range("A1").Name = "Bob"

and set the value as before

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top