Reputation: 7004
Lets say I have a cell C1 and I define the name of it as follows below:
How can I access this cell in VBA?
Upvotes: 1
Views: 191
Reputation: 46
To access it simply write:
Range("act_sec_field").Select
For more information on this you can visit: https://msdn.microsoft.com/en-us/library/office/ff823060.aspx
Upvotes: 1
Reputation: 53623
A Name
which refers to a Range
(a Cell is a Range
) can be accessed by name:
MsgBox Range("asc_set_field").Value
If the Name
is scoped to the Workbook
(default), the above should work. If it is scoped to the Worksheet
, you'll need to refer also to the worksheet:
Dim ws as Worksheet
Set ws = Worksheets("sheet name") ' Modify as needed
MsgBox ws.Range("asc_set_field").Value
Upvotes: 2