Results 1 to 3 of 3

Thread: Error Code 1004 Run Time Error Message - Please Help

  1. #1
    Neophyte GATORWOMAN48's Avatar
    Join Date
    Jan 2020
    Posts
    3
    Articles
    0
    Excel Version
    Excel 2016

    Error Code 1004 Run Time Error Message - Please Help



    Register for a FREE account, and/
    or Log in to avoid these ads!

    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

  2. #2
    Magician NoS's Avatar
    Join Date
    Jan 2013
    Location
    British Columbia
    Posts
    789
    Articles
    0
    Excel Version
    Excel 2010
    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

  3. #3
    Neophyte GATORWOMAN48's Avatar
    Join Date
    Jan 2020
    Posts
    3
    Articles
    0
    Excel Version
    Excel 2016
    Thank you so much for your help! That fixed it and my macro works now beautifully

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •