How to Change the Color of Cell upon Selection?
In this article, you will learn how to change the color of the cell after selecting any color. We will use VBA code to change the color.
I want to change the selected cell color to blue in range B2:E10 when cell is selected through VBA code.
Following is the snapshot of data we have:
We need to follow the below steps:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.Cells.Interior.Color = xlNone
If Not (Intersect(Target, Range(“B2:E10″)) Is Nothing) Then
ActiveCell.Interior.Color = 15651769
In this way, we can fill color in a cell in vba.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.