title: VBA: How to display a cell value by its defined name?
body: <p>I have already a defined name for a particular column in my worksheet.
  How to display a cell value by its defined name?</p>
  
  <p>I've tried these:</p>
  
  <pre><code>  Public Sub Test()
      Dim R As Range
      Set R = ThisWorkbook.Names("SomeName").RefersToRange
      MsgBox CStr(R.Value)
    End Sub
  </code></pre>
  
  <p>but run-time error occured "Type Mismatch" (error code: 13).</p>
  
  <p>What's wrong with the code?
  What is the actual data type of RefersToRange.Value?</p>
  
  <p>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:</p>
  
  <pre><code>  MsgBox CStr(ActiveCell.Value)
  </code></pre>
  
  <p>I've been using Excel 2003</p>