title: Excel VBA -- Subscript out of range with single-dimension array
body: <p>This is an awesomely simple problem, but I've been breaking my head against it for an hour. I'm trying to do the following:</p>
  
  <ol>
  <li>define a VBA array from a named range in my spreadsheet</li>
  <li>Access an item in that array</li>
  </ol>
  
  <p>Now, if the named range happens to cover a multi-dimensional area (rows and columns), then this works fine:</p>
  
  <pre><code>foobar = Range("two_dimensional_range")
  MsgBox foobar(1,1)
  </code></pre>
  
  <p>However, if the named range consists of a single dimension (just a column) of data, then this produces a "Subscript Out of Range" error:</p>
  
  <pre><code>foobar = Range("one_dimensional_range")
  MsgBox foobar(1)
  </code></pre>
  
  <p>I've verified that foobar is really an array. I can iterate through it with For Each ... Next. If I call Ubound(foobar) then it gives me the correct size. I just can't access a single element of it directly!</p>
  
  <p>What am I doing wrong?</p>