+ Reply to Thread
Results 1 to 6 of 6

Autofilter method of range class failed

  1. #1
    Terry K
    Guest

    Autofilter method of range class failed

    Hello all, I have a sub that is failing on one line and I am not sure
    why. The line is
    selection.autofilter field:=6, criteria1:= ">500"
    the error that I get is autofilter method of range class failed. The
    sub is fairly big, that is why I am only posting the one line. if I end
    the sub when it fails here I can go and filter the list based on this
    exact same criteria. I have used the recorder to make sure that the
    line is coded properly. I seems to match what the recorder gives me. Is
    there something special that I need to do when using it in code when
    comared to doing it manually or recording it?
    If more code is needed please let me know and I will post.
    Thanks in advance for any help that anyone can provide.
    Thanks Terry


  2. #2
    Terry K
    Guest

    Re: Autofilter method of range class failed

    Sorry let's post the complete line that fails
    Selection.AutoFilter field:=6, criteria:=">500", Operator:=xlAnd
    Thanks Terry


  3. #3
    Tom Ogilvy
    Guest

    Re: Autofilter method of range class failed

    Here is what I recored and what you posted:

    Selection.AutoFilter field:=6, Criteria1:=">500", Operator:=xlAnd
    Selection.AutoFilter field:=6, criteria:=">500", Operator:=xlAnd

    See the difference. Your argument is Criteria, but the correct argument is
    Criteria1

    --
    Regards,
    Tom Ogilvy


    "Terry K" <[email protected]> wrote in message
    news:[email protected]...
    > Sorry let's post the complete line that fails
    > Selection.AutoFilter field:=6, criteria:=">500", Operator:=xlAnd
    > Thanks Terry
    >




  4. #4
    Terry K
    Guest

    Re: Autofilter method of range class failed

    Sorry about that, my first post I missed the last qualifier and my
    second post I missed the 1 - duhh. My code did actaully have the one in
    it but it still does fail. Any ideas as to what I can try to determine
    why it is failing?
    Thanks Terry


  5. #5
    Tom Ogilvy
    Guest

    Re: Autofilter method of range class failed

    Sheet protected.

    Selection doesn't include 6 columns

    I guess it could be a number of things, but I have never had a problem with
    it when it is applied to an appropriate range.

    --
    Regrds,
    Tom Ogilvy


    "Terry K" <[email protected]> wrote in message
    news:[email protected]...
    > Sorry about that, my first post I missed the last qualifier and my
    > second post I missed the 1 - duhh. My code did actaully have the one in
    > it but it still does fail. Any ideas as to what I can try to determine
    > why it is failing?
    > Thanks Terry
    >




  6. #6
    Terry K
    Guest

    Re: Autofilter method of range class failed

    Not sure either. It does have many more than 6 columns and it is not
    protected. I am not sure either. If I ever do get it figured out I will
    post what the result was. Thanks for the help. Terry


+ 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