[COLOR=navy]Sub[/COLOR] MG09Jul10
'[COLOR=green][B]Code3[/B][/COLOR]
[COLOR=navy]Dim[/COLOR] Rng [COLOR=navy]As[/COLOR] Range, Dn [COLOR=navy]As[/COLOR] Range, ac [COLOR=navy]As[/COLOR] [COLOR=navy]Long,[/COLOR] t
[COLOR=navy]Dim[/COLOR] Rng2 [COLOR=navy]As[/COLOR] Range, Dic [COLOR=navy]As[/COLOR] Object, Q [COLOR=navy]As[/COLOR] Variant
[COLOR=navy]Set[/COLOR] Dic = CreateObject("scripting.dictionary")
Dic.CompareMode = vbTextCompare
[COLOR=navy]With[/COLOR] Sheets("Sheet1")
[COLOR=navy]Set[/COLOR] Rng = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
[COLOR=navy]For[/COLOR] [COLOR=navy]Each[/COLOR] Dn [COLOR=navy]In[/COLOR] Rng
[COLOR=navy]If[/COLOR] Not IsEmpty(Dn.Value) [COLOR=navy]Then[/COLOR]
[COLOR=navy]If[/COLOR] Not Dic.exists(Dn.Value) [COLOR=navy]Then[/COLOR]
[COLOR=navy]Set[/COLOR] Dic(Dn.Value) = CreateObject("Scripting.Dictionary")
[COLOR=navy]End[/COLOR] If
[COLOR=navy]For[/COLOR] ac = 1 To 39
[COLOR=navy]If[/COLOR] Not IsEmpty(.Range("A1").Offset(, ac).Value) [COLOR=navy]The[/COLOR]
Dic(Dn.Value).Add .Range("A1").Offset(, ac).Value, _
Intersect(Dn.EntireRow, .Range("A1").Offset(, ac).EntireColumn)
[COLOR=navy]End[/COLOR] If
[COLOR=navy]Next[/COLOR] ac
[COLOR=navy]End[/COLOR] If
[COLOR=navy]Next[/COLOR] Dn
[COLOR=navy]End[/COLOR] With
[COLOR=navy]With[/COLOR] Sheets("Sheet2")
[COLOR=navy]Set[/COLOR] Rng2 = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
[COLOR=navy]For[/COLOR] [COLOR=navy]Each[/COLOR] Dn [COLOR=navy]In[/COLOR] Rng2
[COLOR=navy]For[/COLOR] ac = 1 To 39
[COLOR=navy]If[/COLOR] Dic.exists(Dn.Value) [COLOR=navy]Then[/COLOR]
[COLOR=navy]If[/COLOR] Dic(Dn.Value).exists(.Range("A1").Offset(, ac).Value) [COLOR=navy]Then[/COLOR]
Q = UCase(Dic(Dn.Value).Item(.Range("A1").Offset(, ac).Value))
[COLOR=navy]If[/COLOR] Not Q = UCase(Intersect(Dn.EntireRow, .Range("A1").Offset(, ac).EntireColumn)) [COLOR=navy]Then[/COLOR]
Intersect(Dn.EntireRow, .Range("A1").Offset(, ac).EntireColumn).Font.Color = vbRed
[COLOR=navy]End[/COLOR] If
[COLOR=navy]End[/COLOR] If
[COLOR=navy]End[/COLOR] If
[COLOR=navy]Next[/COLOR] ac
[COLOR=navy]Next[/COLOR] Dn
[COLOR=navy]End[/COLOR] [COLOR=navy]With[/COLOR]
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]