Eine Familie von Microsoft-Tabellenkalkulationsprogrammen mit Tools zum Analysieren, Darstellen und Vermitteln von Daten.
Hallo nochmals,
da hat sich ein Fehler eingeschlichen :-(
Probiere:
Sub Verschieben()
Dim i As Integer, n As Integer, Antw As Integer
Dim LRow As Long
Dim varRows() As Variant
Application.ScreenUpdating = False
With Sheets("Test1")
LRow = .Cells(.Rows.Count, 1).End(xlUp).Row
For i = 1 To LRow
If .Cells(i, 2).Interior.Color = RGB(0, 176, 240) _
And Application.CountIf(.Range("B:B"), .Cells(i, 2)) = 1 Then
ReDim Preserve varRows(n)
varRows(n) = i
n = n + 1
End If
Next
If n > 0 Then
Antw = MsgBox("Es wurden " & n & " Datensätze gefunden" & Chr(10) _
& "Sollen sie übertragen werden?", vbOKCancel, "Rückfrage")
Else
MsgBox "Keine Daten gefunden": Exit Sub
End If
If Antw = vbOK Then
For i = LBound(varRows) To UBound(varRows)
.Range("A" & varRows(i) & ":F" & varRows(i)).Copy _
Destination:=Sheets("Test2").Cells(Rows.Count, 1).End(xlUp)(2)
Next
For i = UBound(varRows) To LBound(varRows) Step -1
.Rows(varRows(i)).Delete
Next
End If
End With
Application.ScreenUpdating = True
End Sub
Claus