tyle Killer. Deletes all custom styles that get randomly added into workbooks.

PHOTO EMBED

Wed Sep 08 2021 06:00:47 GMT+0000 (Coordinated Universal Time)

Saved by @cnewnham #vba

Sub KillStyles()

' Style Killer. Deletes all custom styles that get randomly added into workbooks. It stops the file getting bloated with 200+ styles, preventing you from copying and pasting information later.

    Dim styT As Style

    'CONFIRMATION THAT YOU WANT TO DELETE STYLES
    If MsgBox("There are: " & ActiveWorkbook.Styles.Count - 47 & " custom styles." & vbNewLine & vbNewLine & _
    "Delete?", vbInformation + vbYesNo) <> vbYes Then Exit Sub
    
    'STATUS BAR UPDATE SO YOU KNOW WHAT'S HAPENNING AND HOW LONG ITS BEEN
    Application.StatusBar = "Deleting styles: Started: " & Time
    
    'ONE SECOND GAP GIVING YOU TIME TO BREAK IF NECESSARY
    Application.Wait Now + (#12:00:01 AM#)
    
    For Each styT In ActiveWorkbook.Styles
    
        If Not styT.BuiltIn Then styT.Delete
    
    Next styT

    'CLEAR STATUS BAR
    Application.StatusBar = False
    
End Sub
content_copyCOPY