I have created a macro which will autofilter a range of cells in column T for "Resolved". It will then copy and paste the filtered data to the next available row in another sheet.
When i run the macro, it seems to be copying and pasting row 1 where all my column headers are in.
Cell T2 Contains "Resolved" yet it is pasting the Range(A1:M1) into my other sheet.
Ive tried a variety of changes such as changing the Offset and End but nothing seems to work.
Sub MoveToPay()
Dim CantPay As Worksheet: Set CopySheet = Sheets("Can't Pay")
Dim ReadyToPay As Worksheet: Set PasteSheet = Sheets("iSeries £ Pay")
Dim lr As Long
Dim S As String
Dim SearchRng As Range, Cell As Range
Application.ScreenUpdating = False
If Not IsError(Application.Match("Resolved", Range("T2:T250"), 0)) Then
Columns(20).AutoFilter 1, "Resolved"
With Range("a2", Range("M" & Rows.Count).End(3)).SpecialCells(xlCellTypeVisible)
.Copy PasteSheet.Cells(Rows.Count, 1).End(1).Offset
.EntireRow.Delete
End With
Columns(20).AutoFilter
MsgBox "Resolved Invoices have been transfered to Ready to Pay"
Else
MsgBox "No Invoices are marked as resolved"
Exit Sub
End If
Application.ScreenUpdating = True
End Sub
Any help would be much appreciated.