Created
August 25, 2010 20:02
-
-
Save subhasisrout/550179 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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