Hallo zusammen,
stehe vor ein Problem...
hab bereits ein Makro, dass mir zwei Tabellen vergleicht und Abweichungen in Tabelle 2 markiert. Leider beginnt es bei Zeile x und geht Zeile für Zeile vor.
Es soll aber erst anhand von 3 gleichen Eingangswerten (Spalte A, C und M) in der erste Tabelle die gleichen Werte finden und dann die ganze Zeile prüfen und in der zweiten Tabelle markieren.
Hoffe es ist nicht zu kompliziert
Anbei das beschriebene Makro
Danke schon mal...
Sub meinVergleich2()
Dim rngT1 As Range, blnDif As Boolean
Dim lngR As Long, lngC As Long, zz As Long, cc As Long
With Worksheets("Tabelle1_alt")
lngR = .Cells(.Rows.Count, 1).End(xlUp).Row
lngC = .Cells(1, .Columns.Count).End(xlToLeft).Column
Set rngT1 = .Range(.Cells(3, 1), .Cells(lngR, lngC))
End With
With Worksheets("Tabelle2_neu")
zz = .Cells(.Rows.Count, 1).End(xlUp).Row
If zz < lngR Then zz = lngR
With .Range(.Cells(3, 1), .Cells(zz, lngC))
.Font.ColorIndex = xlColorIndexAutomatic
.Interior.ColorIndex = xlColorIndexNone
End With
.Range(.Cells(3, lngC + 2), .Cells(zz, lngC + 2)).ClearContents
For zz = 3 To lngR
blnDif = False
For cc = 1 To lngC
If .Cells(zz, cc) <> rngT1(zz - 2, cc) Then
.Cells(zz, cc).Font.ColorIndex = 3
.Cells(zz, cc).Interior.ColorIndex = 6
blnDif = True
End If
Next cc
If blnDif Then .Cells(zz, lngC + 2) = "x"
Next zz
zz = .Cells(.Rows.Count, 1).End(xlUp).Row
If lngR < zz Then
With .Cells(lngR + 1, 1).Resize(zz - lngR, lngC)
.Font.ColorIndex = 3
.Interior.ColorIndex = 6
End With
.Range(.Cells(lngR + 1, lngC + 2), .Cells(zz, lngC + 2)) = "x"
End If
End With
End Sub