Cell Interior Color Vba
Here s a couple ways to change the background color of cell a1.
Cell interior color vba. Check out color reference for colorindex. Need an easy way to determine what number equals what color. Use the interior property to return an interior object.
Change background color of cell range in excel vba examples. Function checkbackgroundcolor cell as range if cell cells count 1 then checkbackgroundcolor enter one cell exit function else checkbackgroundcolor cell interior color end if end function. The color of the tab.
Insert a new module to the project. To set the interior color property of the range of cells a1 to a8 out the equal sign and open rgb function. The following examples will show you how to change the background or interior color in excel using vba.
Range a1 interior color rgb 255 0 0 example 3. The vba color property. Setting cell background to red.
If they re not all the same color color returns 0 zero. Set cell a1 font color to red. Range a1 borders color rgb 255 0 0 excel vb color.
For each cell in selection cells if cell interior color vbwhite then cell interior color rgb 0 0 255 end if next end sub. The color of all four borders of a range. Cells 1 1 interior colorindex 15.