You make a macro which searches for all instances of C, Z, V and Maternity and applies the appropriate forrmat to every found instance...
This will work best if you define a range to search, so that we don't hose the format for the whole sheet (select all the cells in the table which contains C, Z, etc. then, in the top left, just above "A" column heading type a name: "FormatRange" (without quotes).
Now put this code into the worksheet:
Sub AutoFormatRange()
Dim vStrings(0 To 3, 0 To 1) As Variant
Dim i As Integer
Dim rString As Range
Dim sFirstAddress As String
vStrings(0, 0) = "C"
vStrings(0, 1) = 3
vStrings(1, 0) = "Z"
vStrings(1, 1) = 4
vStrings(2, 0) = "V"
vStrings(2, 1) = 5
vStrings(3, 0) = "Maternity"
vStrings(3, 1) = 7
With Me
.Range("FormatRange").Interior.ColorIndex = xlNone
For i = LBound(vStrings) To UBound(vStrings)
Set rString = .Range("FormatRange").Find(vStrings(i, 0))
If rString Is Nothing Then GoTo lNoString
sFirstAddress = rString.Address
Do
rString.Interior.ColorIndex = vStrings(i, 1)
Set rString = .Range("FormatRange").FindNext(rString)
Loop Until rString.Address = sFirstAddress
lNoString:
Next i
End With
End Sub
CC
Bookmarks