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.
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.
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.
Click on the following links for related reference articles. It helps for your reference.