Excel 2007 Remove all Custom Styles

Spaniel

New Member
Joined
May 11, 2009
Messages
15
Hi folks,

A fairly complex excel file I have has decided to play tricks and has set the default style to currency. Now I know the way to reset this is to select the 'normal' style in the list, and change this back to 'general', however I don't have a 'normal' style. All the default ones have been replaced with hundreds (and I mean hundreds - I tried deleting them one by one for a while) of custom styles with this currency format.

Can someone help me to reset this file so that I can see this 'normal' again? Or how to delete all custom styles?

Steps taken so far:

  • Deleted hundreds of custom styles click by click - This got rid of some, there are still more.
  • Open and repair document (assuming it was corrupted) - this did nothing
  • Pulled my hair out - This made me feel better

Thanks in advance.

Sam
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
You could try the following macro that will delete all non-built in styles.

Code:
Sub StyleKill()
     Dim styT As Style
     Dim intRet As Integer
     On Error Resume Next
     For Each styT In ActiveWorkbook.Styles
         If Not styT.BuiltIn Then
             If styT.Name <> "1" Then styT.Delete
         End If
     Next styT
 End Sub
 
Upvote 0
I found this code to work sufficiently (and maybe a little faster)


Sub StyleKill()
Dim styT As Style
Dim intRet As Integer
For Each styT In ActiveWorkbook.Styles
If Not styT.BuiltIn Then styT.Delete
End If
Next styT
End Sub
 
Upvote 0
You could try the following macro that will delete all non-built in styles.

Code:
Sub StyleKill()
     Dim styT As Style
     Dim intRet As Integer
     On Error Resume Next
     For Each styT In ActiveWorkbook.Styles
         If Not styT.BuiltIn Then
             If styT.Name <> "1" Then styT.Delete
         End If
     Next styT
 End Sub

Ok. It´s work fine!
 
Upvote 0
You could try the following macro that will delete all non-built in styles.

Code:
Sub StyleKill()
     Dim styT As Style
     Dim intRet As Integer
     On Error Resume Next
     For Each styT In ActiveWorkbook.Styles
         If Not styT.BuiltIn Then
             If styT.Name <> "1" Then styT.Delete
         End If
     Next styT
 End Sub


This worked fabulously! It is going to save my files!

Just a note for future users: after starting the macro running, I went over to chrome, then back to excel. Excel went kinda-gray, and was indicating it was not-responding. I let it continue this way, figuring it was working so hard it triggered the not-responding warning. After about 10 minutes, excel came back as normal, and my file was fixed!

I was unsure of how this macro worked, so I had run it as a test. I wasn't sure if it would delete all formatting, or just these mystery formats. The formatting I had (and wanted) on my pages remained, and the 650,000 other styles are now gone.

THANK YOU delaneyjim! You have saved my files.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,730
Members
448,987
Latest member
marion_davis

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