Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / February 2005

Tip: Looking for answers? Try searching our database.

Question about Autofilter...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard Latter - 28 Feb 2005 13:10 GMT
Hello All,

I am currently filtering a list using the Autofilter function within
Excel. Great! However, I would like to produce a Summary Report in a
seperate worksheet based on the results of the filter.  Does anyone
know a method of how to obtain criteria on which the Autofilter is
currently filtering on.

Eg.  If I filter a column based on say the word "EDGE", how can you
automatically, obtain this from the autofilter....

Many thanks in advance,

Richard
Peo Sjoblom - 28 Feb 2005 15:43 GMT
Record a macro while you are doing this, select the range and press F5,
special and then visible cells only, copy and and paste

Signature

Regards,

Peo Sjoblom

> Hello All,
>
[quoted text clipped - 10 lines]
>
> Richard
Max - 28 Feb 2005 16:18 GMT
> Eg.  If I filter a column based on say the word "EDGE", how can you
> automatically, obtain this from the autofilter....

Perhaps you might want to try this UDF from a previous post
by Tom Ogilvy  in microsoft.public.excel.programming
Subject: Re: Read AutoFilter Criteria

Here is a user defined function that will display the criteria in a cell:

-- begin vba --
Public Function ShowFilter(rng As Range)
Dim filt As Filter
Dim sCrit1 As String
Dim sCrit2 As String
Dim sop As String
Dim lngOp As Long
Dim lngOff As Long
Dim frng As Range
Dim sh As Worksheet
Set sh = rng.Parent
If sh.FilterMode = False Then
 ShowFilter = "No Active Filter"
 Exit Function
End If
Set frng = sh.AutoFilter.Range

If Intersect(rng.EntireColumn, frng) Is Nothing Then
 ShowFilter = CVErr(xlErrRef)
Else
lngOff = rng.Column - frng.Columns(1).Column + 1
If Not sh.AutoFilter.Filters(lngOff).On Then
  ShowFilter = "No Conditions"
Else
  Set filt = sh.AutoFilter.Filters(lngOff)
  On Error Resume Next
   sCrit1 = filt.Criteria1
   sCrit2 = filt.Criteria2
   lngOp = filt.Operator
   If lngOp = xlAnd Then
    sop = " And "
   ElseIf lngOp = xlOr Then
    sop = " or "
   Else
    sop = ""
   End If
  ShowFilter = sCrit1 & sop & sCrit2
 End If
End If
End Function
-- end vba --

To implement the UDF:
Press Alt+F11 to go to VBE
Click Insert > Module
Copy and paste the UDF* into the white space on the right
*everything within the dotted lines
Alt+Q to get back to Excel

In Excel, if you have an autofilter effected in col C (say)
you could use Tom's UDF by putting in say D1: =showfilter(C:C)
D1 will return the filter criteria effected in col C
Signature

--
Rgds
Max
xl 97
---
GMT+8,  1? 22' N  103? 45' E
xdemechanik <at>yahoo<dot>com
----

> Hello All,
>
[quoted text clipped - 10 lines]
>
> Richard
Ron de Bruin - 28 Feb 2005 16:41 GMT
Hi Richard

If you filter on one column you can use this Add-in to do this.
Very easy to use
http://www.rondebruin.nl/easyfilter.htm

Signature

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

> Hello All,
>
[quoted text clipped - 10 lines]
>
> Richard
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.