Cell Styles Gone Wild! - How do I delete them?

sjl

New Member
Joined
May 30, 2007
Messages
30
Good morning Board,

Alluva sudden I have about 400 cell styles in Excel 2007. I have a heavily formatted workbook, but I never created any named cell styles. A couple of weeks ago, numbers suddenly showed up as Accounting/Euros. I somehow changed the default back to Normal/General (thank you, Board for the direction on fixing that).

This morning the Euro default showed up again. I looked for the Normal cell style and saw hundreds of styles I never saw before. They are definitely names coming from my company - I recognize some of the terms. And, I can't even find the Normal and default Excel styles.

Also, I did try this trick and no dice http://www.rondebruin.nl/sheettemplate.htm Creating a brand new workbook shows the standard Excel 2007 style defaults, including the General number for Normal style. Creating new worksheets in the affected workbooks shows the wrong styles.

1. Is there a better way to delete them en masse besides Cell styles --> right click --> Delete for every stinking one?

2. Where did my Normal cell style go? It's not in the list at all to select and change from Euro to General.


Thanks in advance for your help -
SJL
 
if you are trying to delete all the styles which are not the default ones you can use the builtin property instead of listing all the styles

Code:
Sub RTGF()
Dim S As Excel.Style
For Each S In Application.ActiveWorkbook.Styles
    If Not S.BuiltIn Then S.Delete
Next S
End Sub

I used a very similar code I found online. It has a YES/NO option if you wish to not blindly delete 100% of the custom styles. This is not MY code, so I cannot troubleshoot it, but it worked well for me. If you take the option above with no YES/NO be aware that if you have a massive amount of custom STYLES your PC may look like it has locked up for a while as the script runs....be patient.
Code:
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
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,216,558
Messages
6,131,400
Members
449,648
Latest member
kyouryo

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