+ Reply to Thread
Results 1 to 3 of 3

Advanced Filter Macro Running Slow

  1. #1
    Registered User
    Join Date
    11-30-2015
    Location
    canada
    MS-Off Ver
    2010
    Posts
    3

    Advanced Filter Macro Running Slow

    Hello,

    Using excel 2010, I am trying to use a macro to run an advanced filter. However there are close to 39 000 rows and the entire macro takes about a minute to run. Is there any way to speed this up please?

    Also, when I press escape while the macro is still running I receive a "advanced filter method of Range class failed" error, which is odd because the correct result still appears given enough time. Sorry I am still very new to VBA.

    PHP Code: 
    Sub Advanced_Filter()

        
        
    Application.ScreenUpdating False


        Sheet3
    .Range("Table_Query[#All]").AdvancedFilter Action:= _
            xlFilterCopy
    CriteriaRange:=Range("A2:AC3"), CopyToRange:=Range("A8:AC8"_
            
    Unique:=False
        
        Application
    .ScreenUpdating True

    End Sub 

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Advanced Filter Macro Running Slow

    Not a lot to go on. Worth posting a sample workbook with some typical data so that the structure of the workbook, worksheet and data can be assessed.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    11-30-2015
    Location
    canada
    MS-Off Ver
    2010
    Posts
    3

    Re: Advanced Filter Macro Running Slow

    Hello,

    Sorry about that. I cannot attach the file since it is sensitive information but I'll try my best to describe it. The table is pulled from a database through MS query and has 29 columns as well. There are also a lot of blank cells. The cells are all formatted as general except for a date column which is custom (to include hours). Most of the data is numbers. I initially thought it might be slow because it is from a database but that would not make sense since the advanced filter is taking the information from the table and so shouldn't have any connection with the database.

    I do have other macros on the workbook (search box, clear). It might be slow because of how big the table is but there was an instance where it was filtering instantly but it did slow down again. I have a feeling that it might be because I defined the range as a table instead of an actual range since most of the examples I have seen use ranges. However, I need the range to by dynamic since I may need to edit the table from MS query, making it bigger or smaller.

    I hope this helps!

+ 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. Why my workbook are running filter very slow
    By jatiyanon in forum Excel General
    Replies: 1
    Last Post: 07-21-2015, 12:01 AM
  2. Slow Advanced Filter
    By Lumapi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-25-2015, 02:38 AM
  3. Macro is running real slow and makes navigating the worksheet really slow after execution.
    By MichWolverines in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2013, 04:29 PM
  4. [SOLVED] Advanced Filter Macro does not work, running manually works fine
    By jamiemc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-09-2013, 07:22 PM
  5. Macro to hide/unhide cells not running or running slow
    By mbp727 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-17-2013, 04:22 PM
  6. [SOLVED] Run-time error 1004 when running Advanced Filter for Unique Values in macro
    By jacobadger in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-17-2012, 02:17 PM
  7. Running an Advanced Filter using Userform check boxes
    By gr6au in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2011, 04:51 PM

Tags for this Thread

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