Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Has AutoFiltering Been Applied?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Has AutoFiltering Been Applied?

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Has AutoFiltering Been Applied?

Maybe better now works even if no autofilter exists

Function IsFiltered(MyRange As Range) As String
Application.Volatile
On Error GoTo GetMeOut
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
Exit Function
GetMeOut:
IsFiltered = False
End Function

Mike

"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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Has AutoFiltering Been Applied?

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Has AutoFiltering Been Applied?

Gary,
"ActiveSheet.AutoFilterMode" should do it.
--
Jim Cone
Portland, Oregon USA



"Gary''s Student"
wrote in message
-snip-
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.




  #6   Report Post  
Posted to microsoft.public.excel.programming
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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Has AutoFiltering Been Applied?

Actually, your second post gave me the clue I needed:

Function isfilt(r As Range) As Boolean
Application.Volatile
isfilt = False
On Error GoTo GetMeOut
Set rr = r.Parent.AutoFilter.Range
If Not Intersect(rr, r) Is Nothing Then
isfilt = True
End If
Exit Function

GetMeOut:
End Function


Thanks again for your help.
--
Gary''s Student - gsnu200812


"Mike H" wrote:

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

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Has AutoFiltering Been Applied?

I could see that was the answer but couldn't get there.Nice one.

"Gary''s Student" wrote:

Actually, your second post gave me the clue I needed:

Function isfilt(r As Range) As Boolean
Application.Volatile
isfilt = False
On Error GoTo GetMeOut
Set rr = r.Parent.AutoFilter.Range
If Not Intersect(rr, r) Is Nothing Then
isfilt = True
End If
Exit Function

GetMeOut:
End Function


Thanks again for your help.
--
Gary''s Student - gsnu200812


"Mike H" wrote:

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

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Has AutoFiltering Been Applied?

Thank you
--
Gary''s Student - gsnu200812


"Jim Cone" wrote:

Gary,
"ActiveSheet.AutoFilterMode" should do it.
--
Jim Cone
Portland, Oregon USA



"Gary''s Student"
wrote in message
-snip-
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.



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Has AutoFiltering Been Applied?

Hello Sir,
I don't know you but I want to pay someone to write a simple
accounting program using excel for my new business. I think it is easy for a
person familiar with excel programming. Please tell em if you can help. My
email
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofiltering Thapelo Excel Worksheet Functions 3 November 5th 07 06:44 AM
AutoFiltering Mennochio Excel Discussion (Misc queries) 1 September 15th 06 08:08 PM
autofiltering Reggiee Excel Discussion (Misc queries) 2 August 2nd 06 04:32 PM
Autofiltering [email protected] Excel Discussion (Misc queries) 2 October 4th 05 02:44 PM
Autofiltering musictech[_4_] Excel Programming 3 August 1st 05 09:09 PM


All times are GMT +1. The time now is 11:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"