Error Code 1004 Run Time Error Message - Please Help

GATORWOMAN48

New member
Joined
Jan 21, 2020
Messages
4
Reaction score
0
Points
0
Excel Version(s)
Excel 2016
I created a macro using the below to basically cut the row where the value in column 'F' is "YES" on sheet 1 and move it to the "Resolved" tab in the same workbook and then delete the blank row from the "On Hold" tab. Columns A thru J have data and it would filter off cell F2 then when complete unfilter sheet 1 labeled "On Hold". There are two things that seem to happen. I am getting an error code 1004 about runtime and when it did work at first it kept the info filtered. Much appreciated in advance for your help as I am new to doing code.

Sub COMPLETEDTICKETS()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Range("F2", Range("F" & Rows.Count).End(xlUp)).AutoFilter 2, "YES"
Range("A3", Range("J" & Rows.Count).End(xlUp)).Copy Sheet2.Range("A" & Rows.Count).End(xlUp)(2)
Range("A3", Range("J" & Rows.Count).End(xlUp)).Delete
[F2].AutoFilter

Application.CutCopyMode = False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Sheet2.Select
End Sub
 
Error is due to Range("F2", Range("F" & Rows.Count).End(xlUp)) being a single column range
and .AutoFilter 2 telling it to filter on the second column, which it doesn't have. Change the 2 to 1
 
Thank you so much for your help! That fixed it and my macro works now beautifully :becky:
 
Back
Top