Excel VBA, Get Color Code
This article provides a sample for getting the desired color code. The user selects a fill color for the cell A1. After pressing the Get Code button the color code used will be printed in cell B1.
It can be seen from the figures below that after the user selects a fill color for the cell A1 and presses the Get Code button the color code is printed in cell B1:
Color code 15773696:
The program uses a Button_Click event handler. Whenever the user presses the Get Code button the event handler is executed:
'executes whenever the user presses the Get Code
'button
Private Sub btnRun_Click()
'gets the color code used to fill cell A1a
Cells(1, 2) = Range("A1").Interior.Color
End Sub
You can download the file and code related to this article here.
See also:
- Excel VBA, Color Code
- Excel VBA, RGB
- Excel VBA, Getting the Color Code Using the Macro Recorder
- Excel VBA, ColorConstants
- Excel VBA, XlRgbColor
- VBA Excel, Colors
- Excel VBA, Color Dialog xlDialogEditColor
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