how to replace format

J

Jim

I need to do a replace just so the format is changed. replacing
format in MSWORD is an option, but not in excel....

several cells contain "BYE" in red and a certain font size, some of
the "BYE"s are a different font size... I can't change a range due to
other formats I need to retain...

please email a response... thanks!
 
D

Don Guillett

Why won't this work?

Sub chgfontsize()
For Each c In Selection
If c.Font.Size > 11 Then c.Font.Size = 11
Next
End Sub
 
J

Jim

Don,

that worked great!!! Thanks!

Jim

Don Guillett said:
Why won't this work?

Sub chgfontsize()
For Each c In Selection
If c.Font.Size > 11 Then c.Font.Size = 11
Next
End Sub
 
J

Jim

Don,

I can do some simple macros like that...

The cells with "BYE" are red text

I tried:

Sub chgfontsize()
For Each c In Selection
c.Font.Color = RGB(0, 0, 255)
Next
End Sub

it changed the color for all the cells with numbers, but not the cells
with the text "BYE".... why is that...
 
D

Don Guillett

Probably due to conditional formatting of the cell. This should get both.
===
Font.ColorIndex = 5
Font.Color = RGB(0, 0, 255)
'means the same
-==========

Sub chgfontcolorboth()
On Error Resume Next
For Each c In Selection
c.Font.Color = RGB(0, 0, 255)
c.FormatConditions(1).Font.ColorIndex = 5
Next
End Sub
 
Top