Deleting styles

E

Elardus

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?
 
H

Héctor Miguel

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
 
R

rick.rpp

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top