title: Create new sheet and create table within
body: <p>I would like to create new worksheets, name the new worksheets, add columns to the worksheets, and then make a table in each new spreadsheet, all in a workbook that has one sheet to begin with. My code doesn't work, but to see where I am with this so far:</p>
  
  <pre><code>Sub Create_Sheets()
  
  Sheets.Add.Name = "VA_NAME"
  Sheets.Add.Name = "VA_VALUE"
  Sheets.Add.Name = "CE_NAME"
  Sheets.Add.Name = "CE_VALUE"
  
  Dim Table As ListObject
  Set Table = Sheet1.ListObjects("VA_NAME")
  
  Table.ListColumns.Add 1
  Table.HeaderRowRange(1) = "SOURCE_SEQ_NBR"
  Table.ListColumns.Add 2
  Table.HeaderRowRange(2) = "L1_PARCEL_NBR"
  Table.ListColumns.Add 3
  Table.HeaderRowRange(3) = "L1_ATTR_TEMP_NAME"
  Table.ListColumns.Add 4
  Table.HeaderRowRange(4) = "L1_ATTR_NAME"
  Table.ListColumns.Add 5
  Table.HeaderRowRange(5) = "L1_ATTR_VALUE"
  
  Set Table = Sheet1.ListObjects("VA_VALUE")
  Table.ListColumns.Add 1
  Table.HeaderRowRange(1) = "SOURCE_SEQ_NBR"
  Table.ListColumns.Add 2
  Table.HeaderRowRange(2) = "L1_PARCEL_NBR"
  Table.ListColumns.Add 3
  Table.HeaderRowRange(3) = "L1_ATTR_TEMP_NAME"
  Table.ListColumns.Add 4
  Table.HeaderRowRange(4) = "L1_ATTR_NAME"
  Table.ListColumns.Add 5
  Table.HeaderRowRange(5) = "L1_ATTR_VALUE"
  
  Set Table = Sheet1.ListObjects("CE_NAME")
  Table.ListColumns.Add 1
  Table.HeaderRowRange(1) = "SOURCE_SEQ_NBR"
  Table.ListColumns.Add 2
  Table.HeaderRowRange(2) = "L1_PARCEL_NBR"
  Table.ListColumns.Add 3
  Table.HeaderRowRange(3) = "L1_ATTR_TEMP_NAME"
  Table.ListColumns.Add 4
  Table.HeaderRowRange(4) = "L1_ATTR_NAME"
  Table.ListColumns.Add 5
  Table.HeaderRowRange(5) = "L1_ATTR_VALUE"
  
  Set Table = Sheet1.ListObjects("CE_VALUE")
  Table.ListColumns.Add 1
  Table.HeaderRowRange(1) = "SOURCE_SEQ_NBR"
  Table.ListColumns.Add 2
  Table.HeaderRowRange(2) = "L1_PARCEL_NBR"
  Table.ListColumns.Add 3
  Table.HeaderRowRange(3) = "L1_ATTR_TEMP_NAME"
  Table.ListColumns.Add 4
  Table.HeaderRowRange(4) = "L1_ATTR_NAME"
  Table.ListColumns.Add 5
  Table.HeaderRowRange(5) = "L1_ATTR_VALUE"
  
  Columns.AutoFit
  </code></pre>
  
  <p>I would prefer that the code recognize the sheet name (i.e, "VA_NAME") rather than by "Sheet2, Sheet3" and so on. I know "Set Table = Sheet1.ListObjects("VA_NAME")" is far more than likely my problem, as this relies on "Sheet(X)" convention, but doing Sheets("VA_NAME").ListObjects doesn't work. Is there a quick fix to this, or is what I'm asking against VBA's rules?</p>
  
  <p>Thanks, all!</p>
  
  <p>UPDATE: It's occurred to me that my posted code assumes that tables already exist, and that is not the case.  I have added new code to create actual tables, but without named columns:</p>
  
  <pre><code>Sheet2.ListObjects.Add(xlSrcRange, Range("$A$1"), , xlNo).Name = "VA_NAME"
  Sheet3.ListObjects.Add(xlSrcRange, Range("$A$1"), , xlNo).Name = "VA_VALUE"
  Sheet4.ListObjects.Add(xlSrcRange, Range("$A$1"), , xlNo).Name = "CE_NAME"
  Sheet5.ListObjects.Add(xlSrcRange, Range("$A$1"), , xlNo).Name = "CE_VALUE"
  </code></pre>
  
  <p>My order of operations should be Create Named Sheets --> Create Named Columns --> Create Tables from Columns.</p>