I have already a defined name for a particular column in my worksheet. How to display a cell value by its defined name?
I've tried these:
Public Sub Test()
Dim R As Range
Set R = ThisWorkbook.Names("SomeName").RefersToRange
MsgBox CStr(R.Value)
End Sub
but run-time error occured "Type Mismatch" (error code: 13).
What's wrong with the code? What is the actual data type of RefersToRange.Value?
The documentation says that RefersToRange returns the Range object, but it seems differ with the Range object returned by ActiveCell, because I've no problem with the following code:
MsgBox CStr(ActiveCell.Value)
I've been using Excel 2003