I'm making a basic, quick macro to add values to a cell if it's green or blue. users inputed various shades of green and blue. I pulled all the values:
'blue 33,34,37,41,8
'green 42,35,4
When I try to do an if-then statement with multiple conditions, it returns true for any color. In the example below, every Blue(41) will put a 1 in cell A, but any cell that's not Blue(41) will have a 1.
Why is this? Seemed like a simple, fast way to do this...
For i = 3 To 4000
If IsNull(Range("C" & i)) = True Then
GoTo emptycell
End If
If Range("C" & i).Interior.ColorIndex = 41 Then
Range("A" & i).Value = 1
ElseIf Range("C" & i).Interior.ColorIndex = 4 Or 35 or 42 Then
Range("A" & i).Value = 2
End If
emptycell:
Next i
'blue 33,34,37,41,8
'green 42,35,4
When I try to do an if-then statement with multiple conditions, it returns true for any color. In the example below, every Blue(41) will put a 1 in cell A, but any cell that's not Blue(41) will have a 1.
Why is this? Seemed like a simple, fast way to do this...
For i = 3 To 4000
If IsNull(Range("C" & i)) = True Then
GoTo emptycell
End If
If Range("C" & i).Interior.ColorIndex = 41 Then
Range("A" & i).Value = 1
ElseIf Range("C" & i).Interior.ColorIndex = 4 Or 35 or 42 Then
Range("A" & i).Value = 2
End If
emptycell:
Next i