title: Changing Table Style with VBA for multiple sheets
body: <p>I used the code below to change the table style of a table that is copied over from another sheet. The columns use are B-S, with Row one being headers and the rest are the table data. The rows are likely never to exceed row 1000, but if possible I want to only have the table formatted for the rows show. This will vary every time the table gets updated.</p>
  
  <p>I want to change the table style for 9 different sheets, all with the same column headers, they are just divided by sheet for different departments. When I tried to repeat I ran into an error, so I am reaching out for help. Still basic VBA knowledge</p>
  
  <pre><code>`Sheets("Rich Baran").Select
      Range("B1").Select
      Range(Selection, Selection.End(xlToRight)).Select
      Range(Selection, Selection.End(xlDown)).Select
      ActiveSheet.ListObjects.Add(xlSrcRange, Range("$B$1:$P:P"), , xlYes).Name = _
          "Table3"
      Range("Table3[#All]").Select
      ActiveSheet.ListObjects("Table3").TableStyle = "TableStyleMedium2"
  
  Sheets("Jamie Lorfano").Select
      Range("B1").Select
      Range(Selection, Selection.End(xlToRight)).Select
      Range(Selection, Selection.End(xlDown)).Select
      ActiveSheet.ListObjects.Add(xlSrcRange, Range("$B$1:P:P"), , xlYes).Name = _
          "Table3"
      Range("Table3[#All]").Select
      ActiveSheet.ListObjects("Table3").TableStyle = "TableStyleMedium2"`
  </code></pre>