I've trying to change the tab color following a if logic, for cells C32 and C46. Even though the logic is working for most o the logic some does not bring me the right color. I'm not super familiar with VBA.
What is not working:
C32= Fail and C46= Not Complette (brings me green instead of red)
C32= Not applicable and C46= Not Applicable (brings me red instead of gray)
C32= Not applicable and C46= Not Complete (brings me green instead of gray)
C32= Not Complete and C46= Not Complete (brings me green instead of gray)
C32= Not Complete and C46= Not Applicable (brings me red instead of gray)
Please help. It seems simple to fix but could find the solution
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("$C$32").Value = "Pass" And Range("$C$46").Value = "Pass" Or Range("$C$46").Value = "Not Complete" Then
Me.Tab.ColorIndex = 10
ElseIf Range("$C$32").Value = "Pass" And Range("$C$46").Value = "Not Applicable" Then
Me.Tab.ColorIndex = 48
ElseIf Range("$C$32").Value = "Pass" And Range("$C$46").Value = "Fail" Then
Me.Tab.Color = vbRed
ElseIf Range("$C$32").Value = "Fail" And Range("$C$46").Value = "Fail" Or Range("$C$46").Value = "Not Complete" Or Range("$C$46").Value = "Not Applicable" Then
Me.Tab.Color = vbRed
ElseIf Range("$C$32").Value = "Fail" And Range("$C$46").Value = "Pass" Then
Me.Tab.ColorIndex = 10
ElseIf Range("$C$32").Value = "Not Applicable" And Range("$C$46").Value = "Not Applicable" Or Range("$C$46").Value = "Not Complete" Then
Me.Tab.ColorIndex = 48
ElseIf Range("$C$32").Value = "Not Applicable" And Range("$C$46").Value = "Fail" Then
Me.Tab.Color = vbRed
ElseIf Range("$C$32").Value = "Not Applicable" And Range("$C$46").Value = "Pass" Then
Me.Tab.ColorIndex = 10
ElseIf Range("$C$32").Value = "Not Complete" And Range("$C$46").Value = "Not Applicable" Or Range("$C$46").Value = "Not Complete" Then
Me.Tab.ColorIndex = 48
ElseIf Range("$C$32").Value = "Not Complete" And Range("$C$46").Value = "Pass" Then
Me.Tab.ColorIndex = 10
ElseIf Range("$C$32").Value = "Not Complete" And Range("$C$46").Value = "Fail" Then
Me.Tab.Color = vbRed
End If
End Sub