View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
MBlake[_2_] MBlake[_2_] is offline
external usenet poster
 
Posts: 35
Default Selection.AutoFilter Field:=1

Thanks Ron,
I am getting an error of 'Object Required' when I use it as either the
below - I normally use Option Explicit but if that is included I also get an
Variable Not Defined message.

I'd appreciate one more hint if possible.

Thanks,
Mickey


Sub autofilter_off()
With ActiveSheet
ActiveSheeet.AutoFilterMode = False
End With
End Sub
-----------------------------------------------
Sub autofilter_off()
ActiveSheeet.AutoFilterMode = False
End Sub
-----------------------------------------------


"Ron de Bruin" wrote in message
...
Hi Mickey

ActiveSheeet.AutoFilterMode = False

--
Regards Ron de Bruin
http://www.rondebruin.nl


"MBlake" wrote in message
...
Hi,
I need to turn off the auto filter option and ensure any filtered columns
are returned to non-filter state prior to running some VBA, at present I
am using Selection.AutoFilter Field:=1 and repeating it for each of the
umpteen columns. This looks rather messy and adds a lot of lines to
code. I am sure it can be scaled down to one line, however so far I
haven't managed it. I have tried a few ideas to no avail -

I'd appreciate any advice on this one,
Best Wishes,
Mickey

-------------------------------------------------------------------------
Currently Using -
Selection.AutoFilter Field:=1
Selection.AutoFilter Field:=2
Selection.AutoFilter Field:=3
Selection.AutoFilter Field:=4 etc.
-------------------------------------------------------------------------
Have tried -

Sub Macro2()
'
Selection.AutoFilter Field:=1, Field:=2, Field:=3, Field:=4, Field:=5,
Field:=6
End Sub
--------------------------------------------------------------------------
Sub autofilter_off()
With ActiveSheet
.EnableAutoFilter = True
End With
End Sub
-------------------------------------------------------------------------