Я пытаюсь изменить цвет вкладки после логики if c для ячеек C32 и C46. Даже при том, что logi c работает для большинства из logi c, некоторые не дают мне правильный цвет. Я не очень знаком с VBA.
Что не работает:
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)
Пожалуйста, помогите. Кажется простым исправить, но может найти решение
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