VBA formula to delete all formatting in workbook?

mahmed1

Well-known Member
Joined
Mar 28, 2009
Messages
2,302
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi Guys,

What 's the VBA formula to delete all formatting in workbook, just formatting on the cells? (Not conditional formatting).
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
When you say Delete Formatting, that can mean a lot of different things; Font Bold, Font color, Cell number formats, cell bacground colors, etc.

This will clear just the cell background colors (not conditional formatting) for all sheets.
Code:
Sub Clear_Cell_Backgroud()
        
    Dim ws As Worksheet
    
    For Each ws In Worksheets
        Cells.Interior.ColorIndex = xlNone
    Next ws

End Sub
 
Upvote 0
When you say Delete Formatting, that can mean a lot of different things; Font Bold, Font color, Cell number formats, cell bacground colors, etc.

This will clear just the cell background colors (not conditional formatting) for all sheets.
Code:
Sub Clear_Cell_Backgroud()
        
    Dim ws As Worksheet
    
    For Each ws In Worksheets
        Cells.Interior.ColorIndex = xlNone
    Next ws

End Sub

hi

i mainly need to delete borders
 
Upvote 0
Try

Code:
Sub NoBorders()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
    ws.UsedRange.Borders.LineStyle = xlNone
Next ws
End Sub
 
Upvote 0
Try

Code:
Sub NoBorders()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
    ws.UsedRange.Borders.LineStyle = xlNone
Next ws
End Sub


Thank You
 
Upvote 0

Forum statistics

Threads
1,224,568
Messages
6,179,572
Members
452,927
Latest member
whitfieldcraig

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top