Hi,
I have this code that was created for me awhile back by Event 21 and I need to modify it so that I can change the column that the color coding is going to. Also would be nice to be able to have multiple columns color coded. I would appreciate it greatly if you could explain what the different lines do. I know enough about VBA to be dangerous and I don't want to mess up this great code. It works great for the one project, but I have a couple of others that need to have it expanded. I have found that depending on what we are auditing the column that I need color coded will be in different locations.
[/Sub colorCodeSplit()
Dim a, lr&, r, txt, stxt, ii&, i&, ctr%, ctrCode%
Dim dic As Object
With Application
.ScreenUpdating = False
End With
Set dic = CreateObject("scripting.dictionary")
With Sheet1
lr = .Cells(.Rows.Count, 1).End(xlUp).Row
a = .Range("a7:a" & lr).Value
End With
For Each r In a
If Not dic.exists(Trim(r)) Then
dic.Add Trim(r), Trim(r)
End If
Next
ii = 7
With Sheet8
lr = .Cells(.Rows.Count, 4).End(xlUp).Row
a = .Range("d6:d" & lr).Value
For i = 2 To UBound(a, 1)
txt = Split(a(i, 1), ",")
ctr = 1: ctrCode = 0
For Each stxt In txt
If dic.exists(Trim(stxt)) Then
With Cells(ii, 4)
ctrCode = ctrCode + 1
.Characters(Start:=ctr, Length:=Len(stxt)).Font.Color = RGB(0, 176, 80)
End With
End If
ctr = ctr + Len(stxt) + 1
Next
Cells(ii, "j") = ctrCode
ii = ii + 1
Next
End With
Set dic = Nothing
With Application
.ScreenUpdating = True
End With
MsgBox "done"
End Sub
I appreciate any help that can be provided.
Missit
Bookmarks