The easiest way to change the background color of a cell in VBA is using the color index, so if we want to change the color of cell A1 to red we should write:
Sub change_color()
Activesheet.range("a1").interior.colorindex=3
End sub
I leave here to you the color palette with the respective numbers of the colors, in case you want to color a cell but not with red :)
No comments:
Post a Comment