I'm trying to put a macro where I select Yes
in a row, the next cells are grayed out. So I have got couple of yes columns, but for the life of me can't figure/fix out the error
Error
Runtime Error 1004
Application-defined or object-defied error
Code
Private Sub Worksheet_Change(ByVal Target As Range)
If ActiveCell.Column = 5 Then
Set r = Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 7))
If Target.Value = "Yes" Or Target.Value = "YES" Then
r.Interior.Color = RGB(192, 192, 192)
Else
r.Interior.Color = xlNone
End If
End If
If ActiveCell.Column = 7 Then
Set s = Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 3))
If Target.Value = "Yes" Or Target.Value = "YES" Then
s.Interior.Color = RGB(192, 192, 192)
Else
s.Interior.Color = xlNone
End If
End If
End Sub