jmarting13
New Member
- Joined
- Mar 2, 2021
- Messages
- 39
- Platform
- Windows
I am trying to make it so when a cell value is changed, all the sheets reset their color to black, then any changes made after that use a red font. I am pretty clueless at VBA, but have gotten the code below to work. It only works for my sheet1. Basically I want the font on all the sheets to change to black when cell H3 in sheet1 is changed. Then If the value is revision a-j, I want the font color to be red. can anyone help me with this? Thanks!
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$H$3" Then
Range("A1:J37").Font.Color = vbBlack
End If
If [H3] = "Revision A" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision B" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision C" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision D" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision E" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision F" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision G" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision H" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision I" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision J" Then
Target.Font.Color = RGB(255, 0, 0)
Else
Target.Font.Color = RGB(0, 0, 0)
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$H$3" Then
Range("A1:J37").Font.Color = vbBlack
End If
If [H3] = "Revision A" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision B" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision C" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision D" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision E" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision F" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision G" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision H" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision I" Then
Target.Font.Color = RGB(255, 0, 0)
Else
If [H3] = "Revision J" Then
Target.Font.Color = RGB(255, 0, 0)
Else
Target.Font.Color = RGB(0, 0, 0)
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If