Gruppe
Allgemein
Problem
Tabelle1 soll mit Tabelle2 verglichen werden. Bei Nichtübereinstimmung eines Datensatzes (Zeile) ist die Zeile im relevanten Bereich farbig zu hinterlegen.
StandardModule: basMain
Sub Vergleich()
Dim rng As Range
Dim lRow As Long, lRowT As Long
Dim iCol As Integer
Dim bln As Boolean
Set rng = Worksheets("Tabelle2").Range("A1").CurrentRegion
For lRow = 1 To Range("A1").CurrentRegion.Rows.Count
bln = True
For lRowT = 1 To rng.Rows.Count
For iCol = 1 To 4
If Cells(lRow, iCol) <> rng(lRowT, iCol) Then
bln = False
Exit For
End If
Next iCol
If bln = True Then
Exit For
ElseIf lRowT < rng.Rows.Count Then
bln = True
End If
Next lRowT
If bln = False Then
Range(Cells(lRow, 1), Cells(lRow, 4)).Interior.ColorIndex = 6
End If
Next lRow
End Sub