Excel VBA, Range Fill Color

The following lines all changes the fill color of the range “A1:B1” to blue:

Range("A1:B2").Interior.Color = vbBlue

Same as the previous line but using a different notation:

Range(Cells(1, 1), Cells(2, 2)).Interior.Color = vbBlue

Same as the previous lines but instead of using the blue color constant it uses the blue color code

Range(Cells(1, 1), Cells(2, 2)).Interior.Color = 16711680

For more information about working with colors in VBA for Excel please see VBA Excel, Colors.

Before:

Excel VBA, Fill Range Color

After:

Excel VBA, Fill Range Color After

See Also:

If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website www.software-solutions-online.com

Leave a Reply

Your email address will not be published. Required fields are marked *