I have a macro to sort, cut rows from sheet 1 and paste into sheet 2.
My issue is that every time I populate sheet 1 and run the macro, sheet 2 has duplicate information/rows.
I want the macro to clear sheet 2 from row 2 down first, and then run/cut rows from sheet 1 into sheet 2. Essentially starting with a blank sheet.
The code I'm using is:
Option Explicit
Sub copyrows()
Dim rData As Range
Dim lRw As Long
With Sheets("Tab 2 - Closed Work")
lRw = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
End With
With Sheets("Tab 1 - Open Work")
Set rData = .Range(.Cells(2, 1), .Cells(.Rows.Count, 14).End(xlUp))
If Not .AutoFilterMode Then .Cells(1, 1).AutoFilter
rData.AutoFilter Field:=11, Criteria1:="CLOSED"
rData.Copy Sheets("Tab 2 - Closed Work").Cells(lRw, 1)
rData.SpecialCells(xlCellTypeVisible).EntireRow.Delete
.ShowAllData
End With
End Sub
Bookmarks