title: Excel VBA - Storing table column into a range variable
body: <p>I am currently experimenting with excel VBAs <code>ListObjects</code> which is the object type of an excel table. I would like to <strong>store a table column range into a variable</strong>. </p>
  
  <p>Here is what I can do:</p>
  
  <pre><code>'store a group of cells into a range variable
  dim rng as Range
  set rng = activesheet.Range("A1:A10")
  
  'select a table column
  dim table as ListObject
  set table = activesheet.listobjects("Table1")
  table.ListColumns(1).Range.Select
  </code></pre>
  
  <p>While both of the above work, I don't understand why the following does't work: (<strong>EDIT: it works</strong>)</p>
  
  <pre><code>dim rng_column as Range
  set rng_column = table.ListColumns(1).Range
  </code></pre>
  
  <p>I experimented with other variable types, such as <code>variant</code> or <code>ListColumn</code>, however, nothing stored the cells into the variable. In the example above, there is no error, but the variable <code>rng_column</code> remains <code>&lt;empty&gt;</code>
  I know there are other workarounds, but I really want to understand what's the issue here.</p>
  
  <hr>
  
  <p><strong>UPDATE</strong>
  After some helpful comments I could narrow the problem down. Everything worked normally. However, I made two mistakes. </p>
  
  <p>First, I had a spelling error in the variable names. (I should have included option explicit to notice this earlier). </p>
  
  <p>Second, I passed the range variable on to another range variable, where I forgot to include the <code>set</code> keyword when doing so.. </p>
  
  <p>Hopefully someone can learn from my mistakes..</p>