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
Bookmarks