AW: Suche Makro Ausschneiden und Sortieren
24.05.2006 08:31:50
WernerB.
Hallo Ralf,
wie gefällt Dir das?
Sub Ralf()
Dim wsQ As Worksheet, wsZ As Worksheet, _
laRQ As Long, laRZ As Long, i As Long
Set wsQ = ThisWorkbook.Worksheets("Archiv")
Set wsZ = ThisWorkbook.Worksheets("Register")
With wsQ
laRQ = .Cells(Rows.Count, 9).End(xlUp).Row
For i = 1 To laRQ
If Cells(i, 9).Value = "F" Then
laRZ = wsZ.Cells(Rows.Count, 9).End(xlUp).Row
If laRZ = 1 And wsZ.Cells(1, 9).Value = "" Then laRZ = 0
wsZ.Range(wsZ.Cells(laRZ + 1, 1), wsZ.Cells(laRZ + 1, 18)).Value = _
.Range(.Cells(i, 1), .Cells(i, 18)).Value
.Range(.Cells(i, 1), .Cells(i, 18)).ClearContents
End If
Next i
.Range("A1:R" & laRQ).Sort Key1:=.Range("B1"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
End With
Set wsQ = Nothing
Set wsZ = Nothing
End Sub
Viel Erfolg wünscht
WernerB.
P.S.: Dieses Forum lebt auch von den Rückmeldungen der Fragesteller an die Antworter !