Hello, as I am new to VBA programming, I am not so good at writing concise code (obvious from what you will see below).
Can you please help me condense the following code? My range of values are C19:R19, and C55:R55.
If Range("C19") = "CAR" And (Range("C55") = "--" Or Range("C55") = "YELLOW" Or Range("C55") = "BLACK" Or Range("C55") = "RED") Then
MsgBox "The colour of your car is not valid."
Exit Sub
End If
If Range("D19") = "CAR" And (Range("D55") = "--" Or Range("D55") = "YELLOW" Or Range("D55") = "BLACK" Or Range("D55") = "RED") Then
MsgBox "The colour of your car is not valid."
Exit Sub
End If
.
.
.
.
.
.
If Range("R19") = "CAR" And (Range("R55") = "--" Or Range("R55") = "YELLOW" Or Range("R55") = "BLACK" Or Range("R55") = "RED") Then
MsgBox "The colour of your car is not valid."
Exit Sub
End If
Can you please help me condense the following code? My range of values are C19:R19, and C55:R55.
If Range("C19") = "CAR" And (Range("C55") = "--" Or Range("C55") = "YELLOW" Or Range("C55") = "BLACK" Or Range("C55") = "RED") Then
MsgBox "The colour of your car is not valid."
Exit Sub
End If
If Range("D19") = "CAR" And (Range("D55") = "--" Or Range("D55") = "YELLOW" Or Range("D55") = "BLACK" Or Range("D55") = "RED") Then
MsgBox "The colour of your car is not valid."
Exit Sub
End If
.
.
.
.
.
.
If Range("R19") = "CAR" And (Range("R55") = "--" Or Range("R55") = "YELLOW" Or Range("R55") = "BLACK" Or Range("R55") = "RED") Then
MsgBox "The colour of your car is not valid."
Exit Sub
End If