When you work with other people who use Excel, it is not unusual to copy worksheets from their workbooks into your own workbook. When you do so, the worksheet isn’t the only thing that is copied-Excel also copies their formatting styles to your workbook. Manually deleting the unwanted styles can be a hassle, depending on the number of styles. Removing user-defined styles is very easy, though, if you use a macro. The following macro will quickly delete the unwanted styles:
Sub StyleKill() Dim styT As Style Dim intRet As Integer For Each styT In ActiveWorkbook.Styles If Not styT.BuiltIn Then intRet = MsgBox("Delete style '" & styT.Name & "'?", vbYesNo) If intRet = vbYes Then styT.Delete End If Next styT End Sub
The macro needs just a little user input. Whenever the macro detects a user-defined style, you are asked if you want to delete it. Clicking on the Yes button causes the style to be removed from the workbook.