Thread: autofilter help
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default autofilter help

thanks for the idea, i'll keep it mind

--


Gary


"Dave Peterson" wrote in message
...
You may want to reset the autofilter when the workbook is opened--not saved.
(I
save lots of times and would hate to have my filtering change each time I
save.

One way is to ignore any error that may occur:

Option Explicit
Sub auto_open()
Dim wks As Worksheet
On Error Resume Next
For Each wks In ThisWorkbook.Worksheets
wks.ShowAllData
Next wks
On Error GoTo 0
End Sub

Another way is to check to see if things need to be reset first:

Option Explicit
Sub auto_open()
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
If wks.AutoFilterMode Then
If wks.FilterMode Then
wks.ShowAllData
End If
End If
Next wks
End Sub

Gary Keramidas wrote:

how do i tell if an autofilter is applied so i can reset it when the file is
saved?

--

Gary


--

Dave Peterson