View Full Version : VBA Code to change Color in range of Cells.
kingbob
01-03-2014, 11:57 AM
Helllo,
Can someone assist here.
I need some code so that i can change the font color in Cells A1:D10 color red E1:H10 color green and finally I1:N10 yellow.
I am browsing through google and the forums but struggling here.
Nathan_Hale
01-03-2014, 02:01 PM
Hi.
Sub Color()
Range("A1:D10").Font.Color = -16776961 'red
Range("E1:H10").Font.Color = -11489280 'green
Range("I1:N10").Font.Color = -16711681 'yellow
End Sub
NH
kingbob
01-06-2014, 10:03 AM
Thank you very much for this, i really appreciate it.
Paul_Hossler
01-06-2014, 10:41 AM
Couple of other ways.
There are only 8 predefined vb____ type colors :crying:
Option Explicit
Sub Color1()
Range("A1:D10").Font.Color = vbRed
Range("E1:H10").Font.Color = vbGreen
Range("I1:N10").Font.Color = vbYellow
End Sub
Sub Color2()
Range("A1:D10").Font.Color = RGB(255, 0, 0)
Range("E1:H10").Font.Color = RGB(0, 255, 0)
Range("I1:N10").Font.Color = RGB(255, 255, 0)
End Sub
Paul
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.