Using the Interior Object to Alter the Background of a Range
Sub InteriorExample()
Dim rg As Range
Set rg = ThisWorkbook.Worksheets("Sheet1").Range("A1").Offset(1, 0)
Do Until IsEmpty(rg)
rg.Offset(0, 2).Interior.Pattern = rg.Offset(0, 1).Value
rg.Offset(0, 3).Interior.Pattern = rg.Offset(0, 1).Value
rg.Offset(0, 3).Interior.PatternColor = vbRed
Set rg = rg.Offset(1, 0)
Loop
' create examples of each VB defined color constant
Set rg = ThisWorkbook.Worksheets("Sheet1").Range("A1:E3").Offset(1, 0)
Do Until IsEmpty(rg)
rg.Offset(0, 2).Interior.Color = rg.Offset(0, 1).Value
Set rg = rg.Offset(1, 0)
Loop
Set rg = Nothing
End Sub
Related examples in the same category