Hello. If I have data in column A and B with headers in ten worksheets, how can I create a table for every worksheet without having to go in and manually do it?
Hello. If I have data in column A and B with headers in ten worksheets, how can I create a table for every worksheet without having to go in and manually do it?
This will loop through the sheets and create the tables, the 2nd code will loop through the sheets and remove the tables.
![]()
Sub MakeTables() Dim sh As Worksheet Dim LstRw As Long For Each sh In Sheets With sh LstRw = .Cells(.Rows.Count, "A").End(xlUp).Row .ListObjects.Add(xlSrcRange, .Range("$A$1:$B$" & LstRw), , xlYes).Name = "Table" & sh.Name End With Next sh End Sub Sub RemoveTables() Dim sh As Worksheet For Each sh In Sheets With sh .ListObjects("Table" & sh.Name).Unlist End With Next sh End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks