L
Legacy 191833
Guest
Pulling my hair out over this one. I am trying to run a script to change the cell color if the cell contains (not "equal to") text.
Currently, I'm the following:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("A1:L20")) Is Nothing Then
Select Case Target
Case "AA"
icolor = 1
Case "BB"
icolor = 2
Case "CC"
icolor = 3
Case "DD"
icolor = 4
Case "EE"
icolor = 5
Case "FF"
icolor = 6
Case Else
'Whatever
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub
which worked fine, but now the information contained in the cells is not limited to "AA", "BB", etc. They now have numeric prefixes (e.g. "101 AA", "102 AA") and I still need to identify (color code) cells based on them containing their alphabetic identifers with all "XX AA" same color, all "XX BB" same color, etc.
Thanks in advance, gang!
Currently, I'm the following:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("A1:L20")) Is Nothing Then
Select Case Target
Case "AA"
icolor = 1
Case "BB"
icolor = 2
Case "CC"
icolor = 3
Case "DD"
icolor = 4
Case "EE"
icolor = 5
Case "FF"
icolor = 6
Case Else
'Whatever
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub
which worked fine, but now the information contained in the cells is not limited to "AA", "BB", etc. They now have numeric prefixes (e.g. "101 AA", "102 AA") and I still need to identify (color code) cells based on them containing their alphabetic identifers with all "XX AA" same color, all "XX BB" same color, etc.
Thanks in advance, gang!