How to Delete Multiple Unused Cell Styles in Excel Using VBA
Question details
The user needs to efficiently delete approximately 250 unused custom cell styles from an inherited workbook.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Cleaning up bloated cell formatting in a shared or inherited workbook containing excessive custom styles.
- Observed behavior
- Manually deleting hundreds of custom cell styles is too time-consuming and poses a risk of accidentally damaging the necessary document formatting.
Before running any macro that bulk-deletes formatting, strictly create a backup copy of your workbook, as changes made by VBA scripts cannot be undone using the standard Undo function.
Use a VBA Macro to Delete Non-Built-in Styles
This is the fastest method. It uses a short Visual Basic script to iterate through all styles in the active workbook and automatically deletes any style that is not a default, built-in Excel style.
By utilizing the ActiveWorkbook.Styles property, you can target only the custom styles that were added or imported over time.
Be aware that if any custom style is currently applied to cells in your workbook, deleting it will revert those cells to the default 'Normal' formatting.
Press Alt + F11 on your keyboard to open the Microsoft Visual Basic for Applications window.
In the top menu, click on 'Insert' and select 'Module' to create a blank workspace for your code.
Enter a macro that loops through each style (e.g., 'For Each st In ActiveWorkbook.Styles') and adds the condition 'If Not st.BuiltIn Then st.Delete'.
Press F5 or click the 'Run' button in the toolbar to execute the script and clear all custom styles instantly.

Use a Dedicated Style Management Add-in
If you are uncomfortable writing or running VBA code, you can use a trusted third-party workbook or add-in designed specifically to list and selectively delete unused styles.
Manage Cell Styles Effortlessly with WPS Spreadsheet
WPS Spreadsheet offers robust, intuitive formatting tools and full VBA macro support to help you manage and clean up bloated workbooks. Whether you want to manually manage styles or run automation scripts, WPS Office ensures your inherited data remains neatly formatted and optimized.
- 1. Open Your Workbook: Launch WPS Spreadsheet and open the inherited workbook containing the excess styles.
- 2. Access the Developer Tools: Navigate to the 'Developer' tab on the top ribbon to easily access the VBA editor for running your cleanup macros.
- 3. Manage Styles Manually: Alternatively, go to the 'Home' tab and click on 'Cell Styles' to visually inspect and manage your document's formatting.
- 4. Save Seamlessly: Save your newly cleaned file as an .xlsx document with perfect format retention.

Frequently Asked Questions
Why does my workbook have hundreds of custom cell styles?
Custom cell styles often accumulate unintentionally when users repeatedly copy and paste data, rows, or entire sheets from other workbooks. Over time, these inherited styles duplicate and bloat the file.
Will deleting unused styles mess up my current formatting?
If a custom style is truly unused, deleting it will not impact your document. However, if a custom style is actively applied to cells, deleting that style will revert the affected cells back to the default 'Normal' formatting.
Can I undo the changes made by the VBA macro?
No, actions executed by a VBA macro cannot be undone using the standard Undo shortcut (Ctrl+Z). Always create a copy of your workbook before running a script to delete styles.
Why do some custom styles remain even after running the macro?
Some inherited styles may become corrupted or are tied to protected sheets. You may need to unprotect all sheets in your workbook or use a dedicated XML cleanup method to remove deeply embedded corrupted styles.




