I am trying to have one sheet's code turn the tab green if the value in a series of cells contains anything other than zero. The code seems to be working, but only when I activate one of the cells and hit enter. The sheet is currently set to automatic calculate and the cells are formatted to number. I am using excel 2010.
Is there a line of code I could enter to automatically do the 'activate cell'? I think there must be a better solution to get the short script to work properly.
Is there a line of code I could enter to automatically do the 'activate cell'? I think there must be a better solution to get the short script to work properly.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("H16").Value = 0 And Range("L16").Value = 0 And Range("P16").Value = 0 Then
Me.Tab.ColorIndex = -4142 ' No Color
Else
Me.Tab.ColorIndex = 10 ' Green
End If
End Sub