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 / June 2005

Tip: Looking for answers? Try searching our database.

AutoFilter

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
3@work - 27 Jun 2005 10:06 GMT
How to return the Autofilter value into a specified cell
Paul B - 27 Jun 2005 15:18 GMT
Here is a UDF by Stephen Bullen that will do it

Function FilterCriteria(Rng As Range) As String
   'By Stephen Bullen
'use like =FilterCriteria(A3)
' The single-cell argument for the FilterCriteria function
' can refer to any cell within the column of interest
'do not use the cell with the arrows, it will not update

   Dim Filter As String
   Filter = ""
   On Error GoTo Finish
   With Rng.Parent.AutoFilter
       If Intersect(Rng, .Range) Is Nothing Then GoTo Finish
       With .Filters(Rng.Column - .Range.Column + 1)
           If Not .On Then GoTo Finish
           Filter = .Criteria1
           Select Case .Operator
               Case xlAnd
                   Filter = Filter & " AND " & .Criteria2
               Case xlOr
                   Filter = Filter & " OR " & .Criteria2
           End Select
       End With
   End With
Finish:
   FilterCriteria = Filter
End Function

Signature

Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

> How to return the Autofilter value into a specified cell
 
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.