Sub ConvertTableToRange()
Dim rList As Range
With Worksheets("Sheet3").ListObjects("Table1")
Set rList = .Range
.Unlist ' convert the table back to a range
End With
With rList
.Interior.ColorIndex = xlColorIndexNone
.Font.ColorIndex = xlColorIndexAutomatic
.Borders.LineStyle = xlLineStyleNone
End With
End Sub
If you have multiple worksheets with tables, ensure you know what each table is named.
Sub ConvertTableToRange()
Dim rList As Range
Dim ws As Worksheet
For Each ws In Worksheets(Array("Sheet2", "Sheet3"))
With ws.ListObjects(1)
Set rList = .Range
.Unlist ' convert the table back to a range
End With
With rList
.Interior.ColorIndex = xlColorIndexNone
.Font.ColorIndex = xlColorIndexAutomatic
.Borders.LineStyle = xlLineStyleNone
End With
Next ws
End Sub
Hi
I'm glad it helped.
Just to make it clearer, if you just have 1 table per worksheet you don't need to know its name, you can use the index, like:
Code:Sub ConvertTableToRange() Dim rList As Range Dim ws As Worksheet For Each ws In Worksheets(Array("Sheet2", "Sheet3")) With ws.ListObjects(1) Set rList = .Range .Unlist ' convert the table back to a range End With With rList .Interior.ColorIndex = xlColorIndexNone .Font.ColorIndex = xlColorIndexAutomatic .Borders.LineStyle = xlLineStyleNone End With Next ws End Sub
... and if you want to get rid of all the tables in the workbook you can loop through all the tables in all the worksheets.
Sub ConvertAllTablesToRange()
Dim rList As Range
Dim ws As Worksheet
Dim i As Integer
For Each ws In Worksheets
i = ws.ListObjects.Count ' gets the starting number of tables on the sheet
Do While i > 0 ' loops through every table on the sheet before going to the next sheet
With ws.ListObjects(1)
Set rList = .Range
.Unlist ' convert the table back to a range
End With
With rList
.Interior.ColorIndex = xlColorIndexNone
.Font.ColorIndex = xlColorIndexAutomatic
.Borders.LineStyle = xlLineStyleNone
End With
i = ws.ListObjects.Count ' updates number of tables left on the sheet.
Loop
Next ws
End Sub