Doppelte Datensätze markieren
13.10.2003 12:56:55
Burghard
ich brauche mal Hilfe. Kann mir jemand dieses Makro vielleicht so umschreiben, daß es auch funktioniert, wenn in den Spalten B, C, ... auch Daten stehen?
Im Augenblick markiert dieses Makro nur die doppelten Datensätze (der Spalte A), wenn rechts von Spalte A keine ausgefüllten Zellen mehr stehen.
Über eine Hilfestellung würde ich mich freuen.
Gruß Burghard
Sub Vergleich2()
Dim iRowA As Integer, iRowB As Integer
Dim iCol As Integer, iColor As Integer
Dim iRowC As Integer
Dim bln As Boolean, blnColor As Boolean
iRowA = 2
iColor = 2
Do Until IsEmpty(Cells(iRowA, 1))
iRowB = iRowA + 1
Do Until IsEmpty(Cells(iRowB, 1))
For iCol = 1 To 3
If Cells(iRowA, iCol) <> Cells(iRowB, iCol) Then
bln = True
Exit For
End If
Next iCol
If bln = False Then
If blnColor = False Then
iColor = iColor + 1
End If
If Cells(iRowB, 1).Interior.ColorIndex = _
xlColorIndexNone Then
If Cells(iRowA, 1).Interior.ColorIndex = _
xlColorIndexNone Then
With Worksheets(3)
iRowC = .Cells(Rows.Count, 1).End(xlUp).Row + 1
.Range(.Cells(iRowC, 1), .Cells(iRowC, 1)).Value = _
Range(Cells(iRowB, 1), Cells(iRowB, 1)).Value
End With
End If
Range(Cells(iRowA, 1), Cells(iRowA, 1)). _
Interior.ColorIndex = iColor
Range(Cells(iRowB, 1), Cells(iRowB, 1)). _
Interior.ColorIndex = iColor
blnColor = True
End If
End If
iRowB = iRowB + 1
bln = False
Loop
blnColor = False
iRowA = iRowA + 1
Loop
End Sub