+ Reply to Thread
Results 1 to 8 of 8

Range error for AutoFilter

  1. #1
    Registered User
    Join Date
    12-22-2017
    Location
    Woodstock, Canada
    MS-Off Ver
    2010
    Posts
    3

    Range error for AutoFilter

    I have a combobox which I wish to use to autofilter a range. It appears to work since the autofiltering happens but it always comes up with "AutoFilter method of Range class failed". Please help me...

    Private Sub ComboBox1_Change()
    If ComboBox1.Value <> "ALL" Then
    ActiveSheet.Range("A1:D300").AutoFilter Field:=2, Criteria1:=ComboBox1.Value
    Else
    ActiveSheet.ShowAllData
    End If
    End Sub

    Thanks!
    Attached Files Attached Files
    Last edited by baardaj; 12-23-2017 at 08:36 AM. Reason: Added attachment

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Range error for AutoFilter

    Can you attach a sample of your workbook with any userform(s), code(s) and/or control(s) you are using?
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    12-22-2017
    Location
    Woodstock, Canada
    MS-Off Ver
    2010
    Posts
    3

    Re: Range error for AutoFilter

    I have attached my file to the original post. Its pretty rough right now. I would like to get it functional before I finish.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Range error for AutoFilter

    Move the list you use to fill your combobox to another sheet or below your range with products and your problem's solved.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Range error for AutoFilter

    I'm not sure if this will mess anything else up, but, you could add
    Please Login or Register  to view this content.
    after the Private Sub title line.
    This would prevent the error from showing up.

    Edit* Or do what bakerman2 says
    Last edited by gmr4evr1; 12-23-2017 at 09:53 AM. Reason: added edit

  6. #6
    Registered User
    Join Date
    12-22-2017
    Location
    Woodstock, Canada
    MS-Off Ver
    2010
    Posts
    3

    Re: Range error for AutoFilter

    Thanks guys! Works perfect!

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Range error for AutoFilter

    You're welcome and thanks for rep+.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Last edited by bakerman2; 12-27-2017 at 03:48 AM.

  8. #8
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Range error for AutoFilter

    Welcome, thanks for the rep.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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

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