Avatar of Luis Diaz
Luis Diaz
Flag for Colombia

asked on 

Excel VBA: clear tables activesheets /all sheets

Hello experts,

Following procedure allows me to clear range of tables in activesheet. I would like to have a modulated approach with InpuBox:

If you want to clear tables on activesheet please enter S. If you want to clear all tables of worksheets of activeworkbook please select enter ALL.

Sub Clear_Format_Table()

    Dim WS As Worksheet, oTbl As ListObject
    On Error GoTo Error_Routine
    Set oWS = Application.ActiveSheet
    With oWS
        'Format table
        For Each oTbl In .ListObjects
            oTbl.TableStyle = ""
        Next oTbl
        'Format range
    End With
    Exit Sub
    MsgBox Err.Description, vbExclamation, "Something went wrong!"

End Sub

Open in new window

If you have questions, please contact me.
VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Luis Diaz

8/22/2022 - Mon