Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subhasisrout/550179 to your computer and use it in GitHub Desktop.
Save subhasisrout/550179 to your computer and use it in GitHub Desktop.
//Instructions:
Right click Sheet in the excel workbook. Click "View Code".
Paste the code below.
Start putting data and formatting will automatically happen
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Dim vRngInput As Variant
Set vRngInput = Intersect(Target, Range("A:Z"))
If vRngInput Is Nothing Then Exit Sub
For Each rng In vRngInput
'Determine the color
Select Case rng.Value
Case "Critical Error": Num = 3 'red"
Case "Warning": Num = 5 'maroon
Case "Error": Num = 30 'blue
Case "Critical Warning": Num = 25 'torquoise blue"
End Select
'Apply the color
rng.Font.ColorIndex = Num
Next rng
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment