Deleting styles
When I add from another Excel (2003) file into one of mine, I unfortunately
also inherit all of their styles. I have a file currently with about 50 styles from other people of which about ten of those are different "Normal" styles alone. I know how to delete them one-by-one via Format, Style, Delete (what a tedious process, MS!) till only those remain that I prefer. Is here a way that I can select at once all those I don't want and delete in a single stroke? If not, can someone explain why MS did not allow for this? |
Deleting styles
hi, !
When I add from another Excel (2003) file into one of mine, I unfortunately also inherit all of their styles. I have a file currently with about 50 styles from other people of which about ten of those are different "Normal" styles alone. I know how to delete them one-by-one via Format, Style, Delete (what a tedious process, MS!) till only those remain that I prefer. Is here a way that I can select at once all those I don't want and delete in a single stroke? If not, can someone explain why MS did not allow for this? the following macros does this: first: puts all the styles names starting on active cell downward so you can revise/check/remove/separate/... those you want to remain and let all-togheter those you want to be deleted/erased/removed/... select the result contiguous range and run ... the second: deletes the names in the selected contiguous range (one column) hth, hector. Sub GetStylesNames() Dim n As Integer With ActiveWorkbook.Styles For n = 1 To .Count ActiveCell.Offset(n - 1) = .Item(n).Name Next End With End Sub Sub DeleteSelectedStyles() Dim n As Byte, Styles2Erase As String For n = 1 To Selection.Count Styles2Erase = Styles2Erase & Selection.Cells(n) & """,""" Next ExecuteExcel4Macro "if(delete.style({""" & Styles2Erase & """}))" End Sub |
Deleting styles
I have tried several macros to delete styles however I'm still left with a
large number of styles that appear to be 'untoucheable' - similar to hidden reference names, only I have not found a method to 'unhide' these style names. Are you aware of any method that can clear styles that cannot be modified or deleted? Thanks, Rick "Héctor Miguel" wrote: hi, ! When I add from another Excel (2003) file into one of mine, I unfortunately also inherit all of their styles. I have a file currently with about 50 styles from other people of which about ten of those are different "Normal" styles alone. I know how to delete them one-by-one via Format, Style, Delete (what a tedious process, MS!) till only those remain that I prefer. Is here a way that I can select at once all those I don't want and delete in a single stroke? If not, can someone explain why MS did not allow for this? the following macros does this: first: puts all the styles names starting on active cell downward so you can revise/check/remove/separate/... those you want to remain and let all-togheter those you want to be deleted/erased/removed/... select the result contiguous range and run ... the second: deletes the names in the selected contiguous range (one column) hth, hector. Sub GetStylesNames() Dim n As Integer With ActiveWorkbook.Styles For n = 1 To .Count ActiveCell.Offset(n - 1) = .Item(n).Name Next End With End Sub Sub DeleteSelectedStyles() Dim n As Byte, Styles2Erase As String For n = 1 To Selection.Count Styles2Erase = Styles2Erase & Selection.Cells(n) & """,""" Next ExecuteExcel4Macro "if(delete.style({""" & Styles2Erase & """}))" End Sub |
All times are GMT +1. The time now is 09:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com