Das ganz normale vergleichen habe ich hinbekommen, aber das beispiel von A2 != B1 hat mich zum verzweifeln gebracht
Set objDic1 = CreateObject("scripting.dictionary")
Set objDic2 = CreateObject("scripting.dictionary")
strCount1 = Cells(Rows.Count, 1).End(xlUp).Row
strCount2 = Cells(Rows.Count, 2).End(xlUp).Row
If PfadName1 = False Then
Exit Sub
Else
If PfadName2 = False Then
Exit Sub
Else
'Importieren von Zellen aus Workbook(1) in Dictionary 1
For i = 1 To strCount1
If Not objDic1.exists(Cells(i, 1).Value) Then
objDic1.Add Cells(i, 1).Value, i
End If
Next
'Importieren von Zellen aus Workbook(2) in Dictionary 2
For x = 1 To strCount2
If Not objDic2.exists(Cells(x, 2).Value) Then
objDic2.Add Cells(x, 2).Value, x
End If
Next
'Abfrage ob in aus WB2 ind Dictionary 1 vorhanden
For i = 1 To strCount2
If objDic1.exists(Cells(i, 2).Value) Then
Cells(i, 2).Interior.ColorIndex = 4
Else
Cells(i, 2).Interior.ColorIndex = 3
End If
Next
'Abfrage ob in aus WB1 ind Dictionary 2 vorhanden
For x = 1 To strCount1
If objDic2.exists(Cells(x, 1).Value) Then
Cells(x, 1).Interior.ColorIndex = 4
Else
Cells(x, 1).Interior.ColorIndex = 3
End If
Next
Debug.Print "Spalte 1"
Debug.Print ""
For Each key In objDic1.Keys
Debug.Print key, objDic1(key)
Next key
Debug.Print ""
Debug.Print "Spalte 2"
Debug.Print ""
For Each key In objDic2.Keys
Debug.Print key, objDic2(key)
Next key
End If
End If
|