+ Reply to Thread
Results 1 to 19 of 19

Run-time error '1004' ; AutoFilter Method of Range class failed

  1. #1
    Registered User
    Join Date
    10-08-2008
    Location
    Austria
    Posts
    45

    Run-time error '1004' ; AutoFilter Method of Range class failed

    Hello guys,

    I need your help. I lost 2 days trying to discover the bug in my program, but I coudn't find the right answer.

    How can I activate the AutoFilter to show me the rows selected with "YES" ?

    This is the code... The compiler stops always at the command Selection.AutoFilter.

    Thanx, Boris
    Please Login or Register  to view this content.
    Last edited by BorisMKD; 10-20-2008 at 07:25 AM.

  2. #2
    Forum Contributor Stuie's Avatar
    Join Date
    09-17-2006
    Location
    Suffolk, UK
    MS-Off Ver
    Excel 2003/2007
    Posts
    432
    Hi BorisMKD,

    Have you tried specifing a range to auto filter instead of selection.

    eg.
    Please Login or Register  to view this content.
    There are only 10 types of people in the world:
    Those who understand binary, and those who don't!

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I have deleted the response until Boris adds Code Tags.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    10-08-2008
    Location
    Austria
    Posts
    45
    Dear RoyUK,

    sorry for 'breaking' the forum rules. I really didn't know about putting code-tags. Could you put the response back, please ?

    Thanks

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by BorisMKD View Post
    Dear RoyUK,

    sorry for 'breaking' the forum rules. I really didn't know about putting code-tags. Could you put the response back, please ?

    Thanks
    I have restored the reply, hopefully you have read the rules now.

  6. #6
    Registered User
    Join Date
    10-08-2008
    Location
    Austria
    Posts
    45
    I did. It shows me the same error all the time...

    How can I change this ? Any Ideas ? Please help !!!

  7. #7
    Forum Contributor Stuie's Avatar
    Join Date
    09-17-2006
    Location
    Suffolk, UK
    MS-Off Ver
    Excel 2003/2007
    Posts
    432
    how about adding

    Please Login or Register  to view this content.
    changing the A:A to the column(s) you need

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try this
    Please Login or Register  to view this content.

    If you still get an error then probably your data layout is at fault

  9. #9
    Registered User
    Join Date
    10-08-2008
    Location
    Austria
    Posts
    45
    I've pasted my workbooks in ''C:\My Documents''. Now I get error Subscript out of range
    Donīt know why. Please help me

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    What do you mean by
    I've pasted my workbooks in ''C:\My Documents''.
    ?

    Attach your workbook here so that we can look at it.

  11. #11
    Registered User
    Join Date
    10-08-2008
    Location
    Austria
    Posts
    45
    Thans a lot
    Attached Files Attached Files

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    It's caused because your data is not laid out for AutoFilter. To use AutoFilter the data has to be in a table layout with a Header, with no empty rows or columns. You will find that a manual filter will fail on your current layout.

  13. #13
    Registered User
    Join Date
    10-08-2008
    Location
    Austria
    Posts
    45
    I may not change the form of this table and I really donīt know what do you mean with setting the data in a table layout with a Header.
    But I know that I really need to make this table work for keeping my job. So if you know how to help me, then please do it.
    After that I need to improve the code as well, because this macro has to make more things, like showing the cell values from Area (1 2 3 4) like (1234) in my second workbook

    So RoyUK, please, please help me. Iīm trying more than 3.5 weeks to get the right answer.

    Thanks, Boris

  14. #14
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You simply cannot use AutoFilter with the data laid out like that

  15. #15
    Forum Contributor Stuie's Avatar
    Join Date
    09-17-2006
    Location
    Suffolk, UK
    MS-Off Ver
    Excel 2003/2007
    Posts
    432
    BorisMKD are you not able to format the table in a more data friendly way

  16. #16
    Registered User
    Join Date
    10-08-2008
    Location
    Austria
    Posts
    45
    Is there any other way to make this macro work ?

    Thanks, Boris

  17. #17
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I've altered the sheet so that the code will work.
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    10-08-2008
    Location
    Austria
    Posts
    45
    to Stuie:

    No, I have to keep this form of table. We use the first table like standard in the company. So it cannot be changed at all.
    But do you have any suggestions?

    Thanks, Boris

  19. #19
    Registered User
    Join Date
    10-08-2008
    Location
    Austria
    Posts
    45
    Thanks RoyUK. This helped me a lot.
    I`ll keep working on this untill I donīt finish it all.

+ 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. Select method class range failed
    By phillb in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-05-2007, 06:45 AM
  2. search method of range class failed
    By sarahng86 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-05-2007, 04:23 AM
  3. Paste Method error every other time I run macro
    By jj33002 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-27-2007, 08:38 PM
  4. Select methof of range class failed (1004)
    By Schwizer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-09-2007, 02:33 PM
  5. Assignment overDUE PLEASE PLEASE HELP!!
    By undergrad in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-29-2006, 12:34 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