View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
BrianB BrianB is offline
external usenet poster
 
Posts: 1
Default How? - Error message for turning off autofilter with code

This is one of those macros that I have been meaning to get round to an
not found the necessary motivation. It now resides in my personal.xls.

To check if a filter has been set beforehand it would be necessary t
run the same loop, so there is no point. This will work in any case :-


Code
-------------------

'------------------------------------------------
Sub AUTOFILTER_RESET()
Dim MyFilter As Range
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set MyFilter = ActiveSheet.AutoFilter.Range
cols = MyFilter.Columns.Count
'-----------------------------------
For c = 1 To cols
MyFilter.AutoFilter field:=c
Next
'-----------------------------------
Application.ScreenUpdating = True
MsgBox ("All data visible.")
Application.Calculation = xlCalculationAutomatic
End Sub
'-------------------------------------------------

-------------------


--
Message posted from http://www.ExcelForum.com