View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default re-naming styles

Hi Marcel,

AFAIK you cannot rename a style but you can add a new style "based on" some
cell, eg

With ActiveCell
.ClearFormats
.Style = "OldStyle"
End With
ActiveWorkbook.Styles.Add Name:="NewSyle", Basedon:=ActiveCell

If the idea is to replace existing cells formatted with OldStyle with
NewStyle you'll need to loop all cells in the usedrange of each sheet. Could
be time consuming if you don't know how to limit a search, though there's a
lot you can do to speed up the process. But that's another subject!

Regards,
Peter T


"Marcel Marien" wrote in message
...
Hi,

can anybody tell me whether and if yes how it is possible to re-name a

style
in VBA? I want the style-definition to stay unchanged and just change the
name.

Thanks in advance,
Marcel