title: VBA for selecting a number of columns in an excel table
body: <p>As I learned <a href="https://www.thespreadsheetguru.com/blog/2014/6/20/the-vba-guide-to-listobject-excel-tables" rel="noreferrer">here</a> (also <a href="https://stackoverflow.com/questions/43541445/select-entire-column-in-table-using-excel-vba">quoted in SO</a>) the following code can be used to select the data-body of column 3 in <code>Table1</code>:  </p>
  
  <pre><code>ActiveSheet.ListObjects("Table1").ListColumns(3).DataBodyRange.Select
  </code></pre>
  
  <p>I need help to <strong>select a number of columns together</strong> - say columns 3 to 5, or columns X to X+3 .</p>
  
  <p>Using answers to <a href="https://stackoverflow.com/questions/36041167/code-to-select-multiple-columns-in-an-excel-table">this</a> question I manged to go halfway by using actual column names:</p>
  
  <pre><code>Range("Table1[[Column3]:[Column5]]").Select
  </code></pre>
  
  <p>But I need to be able to use column numbers instead of names, as they will be the result of a function (i.e. columns X to X+d).</p>