Other Issues - Deleting All Custom Cell Styles

Asked By Graham Mutton on 03-Sep-09 08:23 AM
Is there a way for me to delete all custom cell styles in a Excel 2007 workbook, without
having to right-click on each one and delete it individually? When I paste
in data which has been exported from other programs (particularly SAP) I seem
to end up with hundreds of different cell styles which are unnecessary and
annoying for me to scroll through to get down to the automatic cell styles
which I generally use.
Any suggestions gratefully received.

RE = Deleting All Custom Cell Styles

DL M replied to Graham Mutton on 03-Sep-09 08:41 AM
you can view DEMO from this url

http://www.java2s.com/Tutorial/Microsoft-Office-Excel-2007/0060__Format-Style/Removeacustomcellstylefromacell.htm

In excel 2007, it is pretty easy to do this.

[)ia6l0 iii replied to Graham Mutton on 03-Sep-09 08:42 AM
  • Select the cells for which you need to remove the styles, or the whole sheet, 
  • Click Cell Styles under the Home tab.
  • Under the Good, Bad, and Neutral section. Select normal

that should remove all the formatting.

Excel - Deleting 'bulk' Custom Cell Styles

Graham Mutton replied to Graham Mutton on 03-Sep-09 09:02 AM
Hi It's not the cells them selves of sheets that I'm have a problem with its the HOME/CELL STYLES/CUSTOM listing. I've got 100's of custom styles which are a pain to remove by clicking and deleting each one.(It keeps getting bigger each time I paste from other applications) Any suggestions for a bulf remove?
I have read of an add in which can do this but can't track it down.
Thanks in advance for any help you can offer.
Excel Custom Style listings
Graham Mutton replied to [)ia6l0 iii on 03-Sep-09 09:03 AM
Hi It's not the cells them selves of sheets that I'm have a problem with its the HOME/CELL STYLES/CUSTOM listing. I've got 100's of custom styles which are a pain to remove by clicking and deleting each one.(It keeps getting bigger each time I paste from other applications) Any suggestions for a bulf remove?
I have read of an add in which can do this but can't track it down.
Thanks in advance for any help you can offer.
Excel: Deleting All Custom Cell Styles
mv ark replied to Graham Mutton on 03-Sep-09 09:21 AM
The Clear Formats option can remove Cell Styles.

You can add this option to your Quick Access Toolbar & subsequently apply this Clear Formats option to selected cells.

To add Clear Formats option to the Quick Access Toolbar -
Click on Office Button at the extreme top left
Click on the Excel Options button at the bottom of the popup menu
In the dialog box that opens up, choose the Customize tab
From the Choose Commands From combo box, select Home tab
From the list box below it, select the Clear Formats option and add it to the Customize Quick Access Toolbar list box



Now use the Clear Formats option from the Quick Access Toolbar to remove Cell Style from the selected cells.

I am not sure why you found the previous one not to work.
[)ia6l0 iii replied to Graham Mutton on 03-Sep-09 10:17 AM
In either case, select the whole worksheet and choose ' Cell Styles' and set normal. These would remove all the custom styles too.

    If you are finding it tough to do it across worksheets. use a macro instead. 

    Create a macro, and put the following code in it.

    For Each wsheet In Worksheets
      With wsheet.UsedRange
      .Style = "Normal"
      End With
    Next wsheet

    This would set the styles of all worksheets to Normal in the workbook.
    Excel - Deleting 'bulk' Custom Cell Styles
    Graham Mutton replied to [)ia6l0 iii on 03-Sep-09 11:15 AM
    Will this not also remove the formatting that I need to be there? All I want to do is remove it from the drop down menu. I can do this on at a time but I would have thought there is a way of removing them in bulk?
    Thanks for taking time out to ponder my question.
    brock replied to Graham Mutton on 02-Jun-10 02:33 PM
    Did you find a solution to this problem. I have the same issue and it is driving me crazy!
    Graham Mutton replied to brock on 03-Jun-10 07:35 AM
    No, sorry I'm still spending hours click/delete, click/delete. If you find a solution I would love to hear from you again ........
    Chris replied to Graham Mutton on 21-Jun-10 11:17 AM

    Hi

    This excel macro should help. You will need to save and close the workbook for the changes to take affect.

    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

    Delete Active Workbook Styles
    Graham Mutton replied to Chris on 22-Jun-10 03:22 AM

    Hi Chris,

    Thank you for posting but there is one major problem to overcome - ME!

    Never run or had any knowing use of a macro in my life - sad but true........

    I'll have a look around the forum and see if I can get some help at running you script in 2007.

    Thanks for your efforts and keep your fingers crossed for me.

    G

    Jo replied to Graham Mutton on 20-Jul-10 05:09 AM

    Hi Graham,


    1) Right click on the worksheet (eg "Sheet 1").

    2) Click on View Code - this will bring up a Visual Basic code screen for which you can type a macro code. You don't need to type the code...just copy and paste whatever code was sent to you. ie


    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



    3) Save your file as a Macro-Enabled Excel File

    4) Close the file

    5) Reopen the Macro-Enable Excel file

    6) Go to View -> Macro ->View Macros

    7) Click on Run


    All cell styles should be gone without affecting your cell formatting. Worked for me!


    Thanks to whoever sent that macro code through :D


    Jo :)

    hber replied to Chris on 23-Aug-10 11:08 AM
    Thanks a lot for this macro: it solves a long standing issue I had since a while: I waslosing the complete formating of a spreadsheet when I saved it in 2003 format because I had too many cell styles. This allows us to solve a Mircosoft bug in tehg way tehy maange those cell styles whih are multiplied each time you do some copy and paste (mayeb only between two Excel Instance).
    Thanks A LOT
    Laura replied to hber on 27-Aug-10 05:21 AM
    I get a Visual Basic error "400" when i run the macro, any idea what this is? 
    Wendy replied to Laura on 30-Aug-10 08:30 PM
    Same thing happening to me with error 400.....anyone able to help out on this one?
    Nitin replied to Wendy on 30-Sep-10 08:45 AM
    Tyy this 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

    The only difference is that i added the line
        On Error Resume Next
    for error handling
    Not the best error handling but basically ignores all styles it cant delete!!
    The error happens while only deleting a few of the styles with specific names
    Alex replied to Graham Mutton on 01-Aug-11 12:15 PM
    This macro helped me a lot. thanks a lot for it :-)
    Pat replied to Graham Mutton on 29-Sep-11 11:56 PM
    It seems that "cell styles" are very much like how "range names" used to be in the older versions of Excel:  You can only delete them one at a time.  Now, as you may know, through  the "Name Manager' function you can delete many range names at once.  As it stands today, if you "inherit" a model from someone else, you have two choices when deleting cell styles:  Delete each cell style one at a time (like we had to do with range names in Excel 2003 and prior versions), or simply start anew with a brand new spreadsheet, copying whatever you need from the spreadsheet/model you inherited into a completely new spreadsheet.  This is an unfortunate quirk for the new versions of Excel. 
    Jeannette Larson replied to hber on 20-Feb-12 01:54 PM
    I have tried this macro and another I found on the net and neither has worked.  I saw where you need to restart.  I have opened new sheets, closed excel and reopened, re-run the macro, closed and reopened.  Nothing seems to get rid of these cell styles except individually deleting.  It doesn't it seem to be doing anything.  Any ideas?  Thanks.
    XLGeek Coder replied to Graham Mutton on 24-Feb-12 01:25 AM
    MS KB article http://support.microsoft.com/kb/213904 has been updated on 2/20/12 and now in the Resolution section contains links to tools (xls and xlsx file formats) that will allow you to remove all customs styles from your workbooks. You don't need to write and run macros.
    Susan Davenport replied to Jo on 01-Jun-12 02:14 PM
    !!!!!  I think I love you!  We have been suffering because of this nonsense!
    Linda Screeney replied to Nitin on 04-Jun-12 11:27 AM
    I received a syntax error on line 2 using this code
    help
    Dear All, We are using shared excel 2007 sheet, nealy 5 uses are using one shared excel 2007 sheet. In this we have freezed top row and first 3 columns, my problem is SASIKUMAR Hi try this Freeze panes • Click the Sales tab. • In the Sales worksheet, click cell A4 . • Click the View tab. • In the Ribbon, click Freeze Panes , then Freeze Panes . • Scroll
    I failed my Excel 2007 exam and am retaking it tomorrow. In both my Excel exam and earlier in my Word 2007 exam, I had trouble pasting data I had copied. All paste options were greyed out and Control V had no results. Afterward I speculated that the destination cells in the Excel worksheet must have been protected but unfortunately didn't think of that at the time
    Our office runs both office 2003 as well as 2007. Every time a graph (specifically the title / date) is edited on excell 2007. . . the changes are not reflected when opened in the 2003 version. For some reason the aware of? Any feedback would be helpful. Thank you Hi, There are many differences between Excel 2003 and Excel 2007. Some of the changes in Excel 2007 are improvements. Some are strongly disliked by users
    Incompatibility between Excel 2010 & Excel 2007 Microsoft Excel 06-Jun-13 10:15 AM I create a drop down list in Excel 2010 and it does not work in Excel 2007 Could you let us know how you create the drop down list? Try the named quick response! I had created it with "Data Validation" but I had put a range cell in "Source". I tried it by putting a Name in Source and it seems that
    I Just got Excel 2007 installed on my machine. I have used it before and it has worked fine. In I have value 1, A2 has value 2, A3 has value 3 Now in the cell B1 I write a formula, = A1+1. It gives me the value 2. If I copy and paste the formula in Cell B2, B3 etc, it copies the formula right, B2 cell has the formula = A2+1, B3 has = A3+1 etc. But the value is still
    Hello, New to the cafe and new to Excel 2007. We are having an issue at work where a single click on a spreadsheet is selecting a cell and the one or two cells below it. It does not happen on all sheets to stop this? Thanks, WeyBug Hi the solution is on the zoom it is a excel bug if you use 110% , 120% or 130% the problem will happen if you use 100% it will disapear see this post http: / / groups.google.com / group / microsoft.public.excel.crashesgpfs / browse_thread / thread / 6e1cca8eee951571 / 126ce0c2c38531d2?lnk = st&q = #126ce0c2c38531d2 Best Regards Ricardo Veiga Portugal keywords
    I have an intermittent problem - sometimes when i click on an individual cell (be it blank or containing fuigures or a formula) Excel automatically highlights 2 or 3 cells to the right of it as well! When i click away sometimes it will then just highlight that single cell and other times it once again highlights 2, 3 or 4!!! When i open up s just fat fingering :-) Happens to me too. Sometimes I'll try to click one cell and the mouse gets held down and multiple cells get selected. If your cell has
    I'm having some conversion issues with excel 2007. When i go to save a document in Excel 2007, i save it as a "excel 97-2003 workbook" file as our office runs both. I also run a compatibility check
    We are still on EXCEL 2003, but we may implement EXCEL 2007. On e of the questions I have is when using custom filering in 2007, can you search more than 255 characters? Rob There are some issues with Microsoft Excel 2007, here are few of them form Microsoft The following formula issues cause a minor
    This is the Macro code I used to set Max date value in M3 cell, but I dont see the result in M3 is there anything wrong in this script MyExcelWorkBook.xlsm").Activate Range("M3").Select ActiveCell.FormulaR1C1 = " = MAX(R1C8:R10C8)" Thanks in advance. HI Excel VBA macro implementation of the algorithm above will look like below, change code Application.Min oRg) into Application.Max(oRg) to find the maximum value iMin = Application.Min(oRg) 'Select cell containing the min value oRg.Find(What: = iMin, _ After: = oRg.Range( "A1" ), _ LookIn _ LookAt: = xlPart, _ SearchOrder: = xlByRows, _ SearchDirection: = xlNext, MatchCase: = False _ ). Select 'Change selected cell format With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorAccent3 .TintAndShade = 0 .PatternTintAndShade = 0 End