ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing Font Color (https://www.excelbanter.com/excel-programming/294424-changing-font-color.html)

Brad E

Changing Font Color
 
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.

Frank Kabel

Changing Font Color
 
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"

--
Regards
Frank Kabel
Frankfurt, Germany


Brad E wrote:
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.



Tom Ogilvy

Changing Font Color
 
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.

--
Regards,
Tom Ogilvy


"Brad E" wrote in message
...
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.




Brad E

Changing Font Color
 
Thanks, Tom. It was the worksheet and not the workbook
that I wanted to protect.
-----Original Message-----
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.

--
Regards,
Tom Ogilvy


"Brad E" wrote in message
...
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.



All times are GMT +1. The time now is 06:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com