I have the following code that works fine within the given range. However, if a cell within the given range meets the criteria of the macro, how can I add code to change that cell's color to red?
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim rng As Range
For Each rng In Range("D5:D6,D10:D18")
If rng > Range("D21") / 2 Then
rng = Range("D21") / 2
End If
Next rng
Application.ScreenUpdating = True
End Sub
Bookmarks