Excel VBA, Color Code

This article provides a sample on using the color code in VBA for Excel. In this example the user inputs a color code in cell B1. The fill color in cell A1 is changed to the color defined by the color code in cell B1. The program uses a Worksheet_Change event handler. The event handler executes whenever the user changes the value in cell B1:

'executes when the user changes the value in cell B1
Private Sub worksheet_change(ByVal target As Range)
    'changes the color in cell A1
    Range("A1").Interior.Color = Cells(1, 2)
End Sub

Color Code 12:

Excel VBA, Color Code 12
Color Code 450:

Excel VBA, Color Code 450
Color Code 4500:

Excel VBA, Color Code 4500
Color code 850000:

Excel VBA, Color Code 850000

You can download the file and code related to this article here.

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 *