Excel – Delete ALL custom cell styles EXCEL

microsoft excelmicrosoft-excel-2010stylesvba

Is it possible to delete ALL the custom/created cell styles in a workbook ? Just leaving the default styles.

Without having to delete them all one by one

enter image description here

Best Answer

Try this small VBA macro:

Sub StyleKiller()
    Dim N As Long, i As Long

    With ActiveWorkbook
        N = .Styles.Count
        For i = N To 1 Step -1
            If Not .Styles(i).BuiltIn Then .Styles(i).Delete
        Next i
    End With
End Sub

This resolves the Builtin vs Custom issue. Note we run the loop backwards to avoid corrupting the loop index.