Results 1 to 1 of 1

Problem with AutoFilterMode

Threaded View

  1. #1
    Registered User
    Join Date
    04-18-2010
    Location
    Netherlands
    MS-Off Ver
    Excel 2003
    Posts
    1

    Problem with AutoFilterMode

    Hello,

    This is my first thread on this forum, i hope i use the right syntax.

    I have a workbook with 5 sheets. "Compas1" to "Compas3", "Result1" and "Result2". The Compas sheets are filled by a standar application and it is not allowed to change them.
    The Result sheets are predefined formats. The result sheets are filled by the data that is on the Compas sheets, that has to be filtered.

    On "Result1" I added a button that starts a module. The module selects "Compas1" and autofilter is set on with "Selection.Autofilter" and the xlDialogFilter is shown to the user. The user makes a selection and the report in "Result1" is filled. The user closes and saves the workbook. So far, so good.
    The second time he tries to run the report he gets an error. What happens, the module select "Compas1". The filter at "Compas1" is still active by the previous run of the report. The module again turns on the autofilter and tries to show the xlDialogFilter. But it gives error 1004, "Method Autofilter of class Range failed".

    This problem can be avoid if i know what the value is of the AutoFIlterMode, but that is the problem. After selecting the "Compas1" sheet i check the AutoFilterMode, but is is empty. I thought the AutoFilterMode can only have the values TRUE and FALSE.
    How can I prevent this problem. Is it possible that i check the visibledropdown status of the AutoFilter???

    Here is a part of the code:

    ----------
    Sub SelectOpdrachtgeverCompas1()

    Sheets("Compas1").Select
    AutoFilterMode = False
    Selection.AutoFilter
    Application.Dialogs(xlDialogFilter).Show 6

    End Sub
    ---------

    Thanks already,
    Dalli66
    Last edited by Dalli66; 04-19-2010 at 07:08 AM.

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