Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to change font
I need a macro that changes fonts in an excel document from:
Goudy Old Style to Garamond -and- Avenir 45 Book to Gill Sans MT -and- Times New Roman to Garamond If there are other fonts in the document I want to leave them as is. I am only concerned with the above 2 fonts. I have a ton of documents to do which is why I want a macro for it. Thanks in advance for your help. Eli |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to change font
If you're using xl2002+, you can use Edit|Replace and click the options button
and change formats. If you're using xl2k and below, you'll have to loop through all the cells in the usedrange. And if you actually use character by character formatting, you'll have to loop through each cell and loop through each character. wrote: I need a macro that changes fonts in an excel document from: Goudy Old Style to Garamond -and- Avenir 45 Book to Gill Sans MT -and- Times New Roman to Garamond If there are other fonts in the document I want to leave them as is. I am only concerned with the above 2 fonts. I have a ton of documents to do which is why I want a macro for it. Thanks in advance for your help. Eli -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to change font
ps. If you are using xl2002+, try recording a macro when you do it and you'll
have the code. Rerun that macro for all the worksheets/workbooks you want to modify. wrote: I need a macro that changes fonts in an excel document from: Goudy Old Style to Garamond -and- Avenir 45 Book to Gill Sans MT -and- Times New Roman to Garamond If there are other fonts in the document I want to leave them as is. I am only concerned with the above 2 fonts. I have a ton of documents to do which is why I want a macro for it. Thanks in advance for your help. Eli -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to change font
Thanks Dave for pointing me in the right direction. For anyone reading
this in the future here is the code that Excel 2003 generated with the macro recorder. So change the font names to the ones you want to use. Sub Macro1() ' ' Macro1 Macro ' ' With Application.FindFormat.Font .Name = "Times New Roman" .Subscript = False End With With Application.ReplaceFormat.Font .Name = "Garamond" .Subscript = False End With Cells.Replace What:="", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False, SearchFormat:=True, ReplaceFormat:=True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro that will change the font of a cell if i change a value | Excel Discussion (Misc queries) | |||
A macro to change font size | Excel Programming | |||
change font using macro | Excel Programming | |||
Macro to Change Font Color | Excel Programming | |||
Where to stick macro to change default comment font? | Excel Discussion (Misc queries) |