Color Vba Cell at Color

Color Vba Cell. Insert a new module to the project. On the home tab of the ribbon, click conditional formatting > new rule… select “use a formula to determine which cells to format”.

Change Cell Color Excel VBA ExcelSirJi
Change Cell Color Excel VBA ExcelSirJi from www.excelsirji.com

Enter the following code in the module function colorindex (cellcolor as range) colorindex = cellcolor.interior.colorindex end function Do as following steps to determine the color of the cell by vba. Excel vba rgb color rgb can be also termed as red green and blue, this function is used to get the numerical value of the color value, this function has three components as a named range and they are red, blue and green the other colors are considered as the components of these three different colors in vba.

Change Cell Color Excel VBA ExcelSirJi

Enter the following code in the module function colorindex (cellcolor as range) colorindex = cellcolor.interior.colorindex end function Set cell background color range(a1).interior.color = vbyellow set cell font color range(a1).font.color = vbblue Press alt + f11 keys to enable the microsoft visual basic for application window. Alternatively, select a module that has your vba code.