+ Reply to Thread
Results 1 to 9 of 9

VBA Code...error = run time error 1004 autofilter method of range class failed

  1. #1
    Registered User
    Join Date
    06-30-2010
    Location
    Newport New VA
    MS-Off Ver
    Excel 2003
    Posts
    97

    VBA Code...error = run time error 1004 autofilter method of range class failed

    Ok I have some code here. What I want it to do is to find any row that has a 3 in column A..if it does copy it over into a new tab called BSVG...
    however this time I was hoping you guys could help me learn how to correct it, and therby learn code.. So i attached the program below..
    So rather then just giving me the straight out answre right away maybe you can explain something to me and give me hints on how to fix it first.

    file attached for clarity...


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Dariusd7; 11-15-2013 at 03:49 PM.

  2. #2
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: VBA Code...error = run time error 1004 autofilter method of range class failed

    Hi:
    find any row that has a 3 in column A
    or
    find any row that has a 3 in column B
    or change:
    Please Login or Register  to view this content.
    to:
    Please Login or Register  to view this content.
    <=== 1 is column A

    Just guessing (try to answer then I can learn if I'm wrong)

    Regards,
    tt3
    Last edited by tuongtu3; 11-15-2013 at 03:56 PM.

  3. #3
    Forum Contributor
    Join Date
    03-28-2013
    Location
    *
    MS-Off Ver
    Excel 2010
    Posts
    226

    Re: VBA Code...error = run time error 1004 autofilter method of range class failed

    if i understand you correctly check this code....
    Please Login or Register  to view this content.
    I change just a little bit of your code.
    Give Feedback and Click(*)

  4. #4
    Registered User
    Join Date
    06-30-2010
    Location
    Newport New VA
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: VBA Code...error = run time error 1004 autofilter method of range class failed

    Venkatpvc..that worked out well.. perfect..but can you explain what you changed and why..So i can learn..

    thanks...

  5. #5
    Registered User
    Join Date
    06-30-2010
    Location
    Newport New VA
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: VBA Code...error = run time error 1004 autofilter method of range class failed

    Quote Originally Posted by venkatpvc View Post
    if i understand you correctly check this code....
    Please Login or Register  to view this content.
    I change just a little bit of your code.

    This worked well..can you explained what you changed and why? so i can learn the VB code..Thanks

  6. #6
    Registered User
    Join Date
    06-30-2010
    Location
    Newport New VA
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: VBA Code...error = run time error 1004 autofilter method of range class failed

    Quote Originally Posted by tuongtu3 View Post
    Hi:
    or

    or change:
    Please Login or Register  to view this content.
    to:
    Please Login or Register  to view this content.
    <=== 1 is column A

    Just guessing (try to answer then I can learn if I'm wrong)

    Regards,
    tt3
    It find any row in column A that has a 3

  7. #7
    Forum Contributor
    Join Date
    03-28-2013
    Location
    *
    MS-Off Ver
    Excel 2010
    Posts
    226

    Re: VBA Code...error = run time error 1004 autofilter method of range class failed

    tuongtu3 already notified what is you mistake,
    or change:

    .Range("A2:B" & LastRow).AutoFilter 0, 3 to:



    .Range("A2:B" & LastRow).AutoFilter 1, 3 <=== 1 is column A

    Just guessing (try to answer then I can learn if I'm wrong)
    and the other one you used loops, unnessary.

    thats difference for your code and mine(changes of your code)


    can you expaline me why you use this below line in your vba code

    Please Login or Register  to view this content.

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA Code...error = run time error 1004 autofilter method of range class failed

    Hi, Dariusd7,

    please do not post the same quesiton in multiple threads in Excelforum according to Forum Rule #5.

    http://www.excelforum.com/excel-prog...ss-failed.html

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  9. #9
    Registered User
    Join Date
    06-30-2010
    Location
    Newport New VA
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: VBA Code...error = run time error 1004 autofilter method of range class failed

    Quote Originally Posted by venkatpvc View Post
    tuongtu3 already notified what is you mistake,


    and the other one you used loops, unnessary.

    thats difference for your code and mine(changes of your code)


    can you expaline me why you use this below line in your vba code

    Please Login or Register  to view this content.
    Actualy its was part of another code that had the same function but identified about 5 different variables.. and since i dont know VB code and syntax..i used the whole code to do the same
    thing except it would only need to find one variable and that was the number 3.. Since i do not understand VB code I jused the whole program...I must say c, C++,C# and java is so much
    easier to follow and understand...and believe me i am not a guru at any of them.. but i can read them and follow them a lot easier then VB...

+ 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. Replies: 4
    Last Post: 11-15-2013, 05:03 PM
  2. [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
  3. 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
  4. 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
  5. 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