Hello forum,
I have a weekly Excel workbook with a separate Sheet for each workday. Each Sheet has data that I want to convert into a table with VBA. I recorded the code below but it will not function correctly after the first sheet is saved. The error message comes back with "a table can't overlap another table". Is there a way to count the number of current tables in the workbook and have VBA create a new table with the next Table#?
Code
Sub TableMac()
'
' TableMac Macro
'
Dim LastRow As Long
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Application.CutCopyMode = False
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$AA" & LastRow), , xlYes).Name _
= "Table1"
Range("Table1[#All]").Select
ActiveSheet.ListObjects("Table3").TableStyle = "TableStyleMedium6"
Range("Table1[[#Headers],[Vndr Num]]").Select
End Sub
Display More
I appreciate your feedback,
Thank you