I am exporting a data set weekly that needs to be set as a table, however there will be a varying number of rows each week (columns will not change).
Here is what I have so far:
Sub Eformat_as_table()
Dim project_count As Integer
Dim new_table As Range
project_count = 0
For a = 1 To 10000
If Cells(a, 1) = "" Then
Else
project_count = project_count + 1
End If
Next a
ThisWorkbook.Sheets("format sheet").Range(Cells(1, 1), Cells(project_count, Columns.Count).End(xlToLeft)).Name = "Table"
Set new_table = Range("Table")
ActiveSheet.ListObjects.Add(xlSrcRange, Range(new_table), , xlYes).Name = _
"Table2"
ActiveSheet.ListObjects("Table2").TableStyle = "TableStyleMedium1"
End Sub
I believe my problem is setting the new table object to the new_table range.
I'm stumped.