Sithu05
Sithu05

Reputation: 146

Can't change font color in Excel VBA

I can trying to change font color in Excel Sheets.

Code is:

Sub sbChangeFontColor()

Cells(4, 2).Font.ColorIndex = 3 

Range("B4").Font.ColorIndex = 3

Cells(4, 2).Font.Color = RGB(255, 0, 0)

Range("B4").Font.Color = RGB(255, 0, 0)

End Sub

Already, I used these code in Macros of my Excel Sheet. When I run the Macros code, Excel Sheet Font not changed and also not throwing any error messages. How to solve this problem?

Upvotes: 0

Views: 3359

Answers (1)

Gary's Student
Gary's Student

Reputation: 96753

There is no error in your code..........the cells are being coloured on some worksheet.....the Active worksheet.

Check your sheets and Select the proper sheet before running the code.

Upvotes: 2

Related Questions