AW: Frage...
13.10.2020 22:03:56
Werner
Hallo,
Option Explicit
Public Sub Leere_Kopieren()
Dim loLetzteQ As Long, loLetzteZ As Long
Application.ScreenUpdating = False
With Worksheets("Tabelle1")
loLetzteQ = .Cells(.Rows.Count, "B").End(xlUp).Row
On Error Resume Next
.Range(.Cells(1, "A"), .Cells(loLetzteQ, "A")).SpecialCells(xlCellTypeBlanks).EntireRow. _
Copy
If Err.Number = 1004 Then Exit Sub
With Worksheets("Backup")
loLetzteZ = .Cells(.Rows.Count, "B").End(xlUp).Offset(1).Row
If .Cells(1, "B") = "" Then loLetzteZ = 1
.Cells(loLetzteZ, "A").PasteSpecial Paste:=xlPasteValues
loLetzteZ = .Cells(.Rows.Count, "B").End(xlUp).Row
.Range(.Cells(1, "B"), .Cells(loLetzteZ, "Z")).Sort Key1:=.Range("B1"), Order1:= _
xlAscending, _
Header:=xlNo, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
End With
.Range(.Cells(1, "A"), .Cells(loLetzteQ, "A")).SpecialCells(xlCellTypeBlanks).EntireRow. _
Delete
End With
End Sub
Gruß Werner