Forum Discussion
WHBurling
Dec 07, 2022Copper Contributor
vba - choosing Workbook object vs Range object in accessing named values
I need help in understanding why one might use a workbook object vs a range object in the accessing of a named value in a workbook An example of the workbook object approach is: Dim DataPtr as i...
HansVogelaar
Dec 07, 2022MVP
RefersTo returns a string that contains the full address of the named range, for example
"=Sheet1!$A$"
Since ReferstTo returns a string, not a range, you cannot use RefersTo.Value.
You can define names at the workbook level but also at the worksheet level. So the Worksheet object also has a Names collection.
And a defined name does not have to refer to a range - it can also refer to a fixed value, for example 37, or to an expression (formula).