VBA Clear Table Format

VBA Clear Table Format in Excel

VBA Clear Table Format in Excel. Clearing or deleting or removing formatting from the table in Excel using VBA. Here we use the ListObjects collection and TableStyle property to delete or clear format. In this tutorial let us learn the example and step by step instructions to clear Format from the table.

Example to VBA Delete Table Formatting in Excel

Let us see the example to clear Format or styling from the table of data body range. The sheet name defined as ‘Table‘. And we use table name as ‘MyDynamicTable‘. You can change these two as per your requirement. Where TableStyle property is used to remove format from the table.

'VBA Clear Table Format
Sub VBAF1_Clear_Table_Format()
    
    'Declare Variables
    Dim sTableName As String
    Dim sSheetName As String
    
    'Define Variables
    sSheetName = "Table"
    sTableName = "MyDynamicTable"
    
    'Clear or Remove Table Format
     Sheets(sSheetName).ListObjects(sTableName).TableStyle = ""
    
End Sub

Output: Here is the following output screenshot of above example macro code.

VBA Clear Table Format in Excel

Instructions to Use Example Macro Code

You can follow step by step instructions to run above macro example VBA code.

  • Open Visual Basic Editor(VBE) by clicking Alt +F11
  • Go to code window by clicking F7
  • Copy above specified macro or procedure
  • Paste above copied code in code window in the visual basic editor(VBE)
  • Run macro by clicking F5 or Run command
  • The difference between before and after macro, see the output screenshot.

Other Related References

Click on the following links for related reference articles. It helps for your reference.

VBA Tables Tables Examples

Leave a Comment

Your email address will not be published. Required fields are marked *