View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike Gallagher[_2_] Mike Gallagher[_2_] is offline
external usenet poster
 
Posts: 7
Default toggle between autofilter Criteria1:= "*" and "all"

I'm using autofilter to collapse and expand a range based on value of Criteria1
I would like to use code to be able to alternate between Criteria1:="1" and
Criteria1:="All"

This is the code that i thought would work but hasn't -

Dim filtcrit

filtcrit = Criteria1

With ActiveSheet
If filtcrit = 1 Then
Selection.AutoFilter Field:=1

Else
Selection.AutoFilter Field:=1, Criteria1:="1"

End If
End With