Results 1 to 5 of 5

Run time error 1004: Autofilter method of range class failed in personal macro workbook.

Threaded View

Asad Mir Run time error 1004:... 06-24-2020, 03:25 AM
romperstomper Re: Run time error 1004:... 06-24-2020, 04:48 AM
Asad Mir Re: Run time error 1004:... 06-24-2020, 01:03 PM
romperstomper Re: Run time error 1004:... 06-24-2020, 01:24 PM
Asad Mir Re: Run time error 1004:... 06-24-2020, 02:04 PM
  1. #1
    Registered User
    Join Date
    07-13-2019
    Location
    Mansehra, Pakistan
    MS-Off Ver
    2010
    Posts
    46

    Run time error 1004: Autofilter method of range class failed in personal macro workbook.

    Hello everyone!

    I ran following code on my data to remove Outline from my data and to filter non-blank rows and delete hidden/filtered rows.
    I wanted to keep this code in personal macro workbook. Yesterday i tested this code in personal macro workbook and it worked fine.
    Today i copied the same code in personal macro workbook, on execution i received the error noted in the subject. Need help on rectifying this error.

    Another strange thing i noticed, in the below mentioned code, i wrote the code for removing the outline from my data but it does not get
    executed even when it is written before "Autofilter Code" (as the error arises in "Autofilter" line of code). Does code written inside"With / End with" construct"
    executes at once or line by line?
    Sub FBL3N()
    Dim sh As Worksheet
    Dim r As Long
    Dim LastRow As Long
    Const StartRow As Long = 1
    
    Set sh = ThisWorkbook.Worksheets("Sheet1")
    Application.ScreenUpdating = False
    sh.AutoFilterMode = False
    With sh.Range("A1")
        .ClearOutline
        .AutoFilter Field:=1, Criteria1:="<>"
    End With
    'LastRow = sh.Cells(Rows.Count, "A").End(xlUp).Row
    LastRow = sh.UsedRange.Rows.Count
    For r = LastRow To StartRow Step -1
        If Rows(r).Hidden = True Then
            Rows(r).Delete
            'Range("F" & r).Value = "X"
        End If
    Next r
    Call Variant_Array1
    Call Variant_Array2
    
    sh.AutoFilterMode = False
    Application.ScreenUpdating = True
    
    End Sub
    Any help would be highly appreciated

    Thanks!
    Last edited by Asad Mir; 06-24-2020 at 03:27 AM. Reason: Wanted to add tags...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro Error on Filtering – “Run-time error ‘1004’ Autofilter method of range class failed
    By kschmit1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2019, 11:49 AM
  2. Runtime error '1004' - Autofilter method of Range class failed
    By penfolda in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-18-2014, 12:04 PM
  3. Replies: 4
    Last Post: 11-15-2013, 05:03 PM
  4. VBA Code...error = run time error 1004 autofilter method of range class failed
    By Dariusd7 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-15-2013, 04:49 PM
  5. Run-time error '1004' ; AutoFilter Method of Range class failed
    By ESMAMAF in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-18-2012, 06:30 PM
  6. Run Time Error 1004: Autofilter method of range class failed
    By HP RodNuclear in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-07-2010, 05:37 PM
  7. Run-time error '1004' ; AutoFilter Method of Range class failed
    By BorisMKD in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 10-20-2008, 05:47 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1