Quickie ! How to refer to a Name in VBA

Example: This is very easy ... if I explain it correctly!

I have a value "J" stored in cell A1. (This value will change!)
I then define a NAME so that cell A1 is named "Initial"

In VBA code I want to set strInitial =   the value in name "Initial"
See below.  

dim strInitial as string
    strInitial = ?????

What is the correct syntax so that strInitial will hold the value of "Initial"
Patrick O'DeaAsked:
Who is Participating?
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Connect With a Mentor Microsoft MVP ExcelCommented:
Hello,

Range.("initial")

cheers
0
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
Or, to complete your code lines

dim strInitial as string
    strInitial = Range.("Initial")
0
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Connect With a Mentor Microsoft MVP ExcelCommented:
Sorry, not quite awake yet. no dot!!

Dim strInitial As String
    strInitial = Range("Initial")
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
jppintoConnect With a Mentor Commented:
0
 
Patrick O'DeaAuthor Commented:
Thanks all.
I said it was a quickie!

I will check the links out jppinto
0
 
patrickabCommented:
This is much simpler and will also work:

dim strInitial as string
strInitial = [Initial]

The [] square brackets just mean evaluate.

Patrick
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.