+ Reply to Thread
Results 1 to 2 of 2

Macro Error on Filtering – “Run-time error ‘1004’ Autofilter method of range class failed

  1. #1
    Forum Contributor
    Join Date
    09-08-2016
    Location
    Buffalo, NY
    MS-Off Ver
    365
    Posts
    115

    Macro Error on Filtering – “Run-time error ‘1004’ Autofilter method of range class failed

    Hello,

    I am trying to record a macro where I am using =LENS in column E to determine the total number of characters in column D. From there I am trying to filter out any results that <>4 so I can delete them and be left only with the rows that contain 4 characters. However whenever I get to the filtering portion of the code I receive an error before the deletion piece can occur. I am receiving the error message “Run-time error ‘1004’ Autofilter method of range class failed”. I have reviewed a number of posts on the subject but cannot seem to find any specific to my issue. Any thoughts on how I am receiving this error based on the portion of code I have listed below?

    I have tried even changing the Range to only be for column E and continue to run into this same issue.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro Error on Filtering – “Run-time error ‘1004’ Autofilter method of range class fa

    You could set the row height to zero of the records you want to keep and then delete the visible records and then reset the row height to 15 or whatever. Or, you could make a union of the "bad" records and delete that union.
    Last edited by xladept; 02-25-2019 at 03:57 PM. Reason: added an option
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. 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
  2. Replies: 4
    Last Post: 11-15-2013, 05:03 PM
  3. 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
  4. [SOLVED] VBA Error: Runtime Error 1004: AutoFilter method of Range class failed
    By jl22stac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2013, 07:27 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