Changing Font Color

B

Brad E

I have a password protected workbook. I keep getting
errors with either of the following lines.

Range("F8:F13").Font.ColorIndex = 3
Range("F8:F13").Font.Color = RGB (255,0,0)

This selection is currently white font, and upon running
the macro I would like to show it to the user (change the
font to red).

When I unprotect the workbook, the macro works fine.

TIA, Brad E.
 
F

Frank Kabel

Hi
you have to unprotect your worksheet in your macro and protect i again
afterwards. So something like
activesheet.unprotect password:="your password"
Range("F8:F13").Font.ColorIndex = 3
Range("F8:F13").Font.Color = RGB (255,0,0)
activesheet.protect password:="your password"
 
T

Tom Ogilvy

Activesheet.Unprotect password:="ABCD"
Range("F8:F13").Font.ColorIndex = 3
Activesheet.Protect password:="ABCD"

I am sure you mean worksheet level protection as workbook level protection
should have no effect.
 
B

Brad E

Thanks, Tom. It was the worksheet and not the workbook
that I wanted to protect.
 
Top