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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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
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,223,731
Messages
6,174,173
Members
452,548
Latest member
Enice Anaelle

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