View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Has AutoFiltering Been Applied?

I see what you mean, it's easy to detect at the worksheet level but on a
single cell now that's a poser. Il be interested if this one gets solved.

Mike

"Gary''s Student" wrote:

First, thank you for your response.

Your function responds to the STATE of the AutoFilter:

1. if the user selects one of the autofilter options, the function returns
True
2. if the user selects (All), the function return False

I need something a litle different. I need the function to return True once
the user has switched on Auto filtering for the cell in question thru
something like:

Data Filter Autofilter

You see, I don't care which option the user may choose from the filter
pull-down, only that filtering has been enabled and the pull-down can be used.

In any case, the code you posted is valuable and I will use it in the future.

Thanks for the help.
--
Gary''s Student - gsnu200812


"Mike H" wrote:

Try,

Function IsFiltered(MyRange As Range) As String
Application.Volatile
With MyRange.Parent.AutoFilter
If Intersect(MyRange, .Range) Is Nothing Then GoTo GetMeOut
With .Filters(MyRange.Column - .Range.Column + 1)
If Not .On Then
IsFiltered = False
Else
IsFiltered = True
End If
End With
End With
GetMeOut:
End Function

Mike

"Gary''s Student" wrote:

I need a simple Boolean function (UDF):

=isfilted(A1)

That will return TRUE if AutoFiltering has been applied to A1, otherwise
FALSE.

Thanks in advance
--
Gary''s Student - gsnu2007xx