+ Reply to Thread
Results 1 to 9 of 9

Error Using filters "Method of range class failed"

  1. #1
    Registered User
    Join Date
    05-03-2010
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    59

    Error Using filters "Method of range class failed"

    So, I'm trying to use a filter to get a certain type of data for an entire column. I want the macro to operate so that it works for as long as the column goes, because number of data points would change often for my uses. When I tried to run the macro I got an error:

    "Run time error '1004':
    Auto Filter method of Range class failed"

    My code is:
    Please Login or Register  to view this content.
    and it is the first line "Selection.AutoFilter" which gives the error

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Error Using filters "Method of range class failed"

    Replace that line with this:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    05-03-2010
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Error Using filters "Method of range class failed"

    whoa thanks alot, that worked like a charm. Do you mind explaining what the error was and how that code fixed it?

    Also, If i want to create a corresponding column of numbers going up by some integer, but then stopping when there are no more values in the original column, how would i do that?

    For example, say i have a column like this:

    3.4
    5.4
    5.4
    2.3
    1.2
    4.5
    2.1
    5.3

    I want to create a column next to it that goes up in integers, for example going up in 5s:

    5
    10
    15
    20
    25

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Error Using filters "Method of range class failed"

    The error occurred because you were trying to remove an autofilter that didn't exist.
    Do you want to add these manually or in code?

  5. #5
    Registered User
    Join Date
    05-03-2010
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Error Using filters "Method of range class failed"

    In code, along with the other set of code, all in one macro

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Error Using filters "Method of range class failed"

    Where is the data supposed to go, which row does it start in and which column can be used to determine the last row?

  7. #7
    Registered User
    Join Date
    05-03-2010
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Error Using filters "Method of range class failed"

    It starts in the same row as the pasted column from the autofilter, which is now row 2. The column used to determine the last row is also the pasted column from the autofilter.

  8. #8
    Registered User
    Join Date
    05-03-2010
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Error Using filters "Method of range class failed"

    nvm, thanks for all the help, i figured out how to do the 2nd part

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Error Using filters "Method of range class failed"

    Try this:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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