+ Reply to Thread
Results 1 to 4 of 4

Advanced Filtering

Hybrid View

jn_mohit Advanced Filtering 03-14-2008, 01:09 AM
Portuga You can use the auto filter... 03-14-2008, 01:38 AM
jn_mohit Thanks for your help but I am... 03-14-2008, 01:46 AM
Portuga The VBA code I wrote above... 03-14-2008, 02:06 AM
  1. #1
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852
    You can use the auto filter for this. with auto filter on, run the following code:

    Sub Autofilter()
    '
    
        Selection.Autofilter Field:=1, Criteria1:="=1", Operator:=xlOr, _
            Criteria2:="=2"
        Selection.Autofilter Field:=3, Criteria1:="=diff", Operator:=xlAnd
        Selection.Autofilter Field:=4, Criteria1:="=25", Operator:=xlOr
        Selection.Autofilter Field:=5, Criteria1:="=6", Operator:=xlOr, _
            Criteria2:="=7"
        Selection.Autofilter Field:=6, Criteria1:="=2,25", Operator:=xlAnd
    End Sub
    Last edited by Portuga; 03-14-2008 at 01:49 AM.
    If you found the solution to your question. Mark the thread as "Solved"
    Thank everyone that helped you with a valid solution by clicking on their

    There is no such thing as a problem, only a temporary lack of a solution

  2. #2
    Registered User
    Join Date
    07-08-2005
    Posts
    11
    Thanks for your help but I am not sure how many columns I would have, it could be 1 or it could be 6.

    Some columns can be empty too (in my program I can avoid to put those kind of columns if required).

    The unknown number of colums is what is giving me the main problem. Also I need a way to write this as a code.

    Thanks
    Mohit

  3. #3
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852
    The VBA code I wrote above can be applied to an auto filter, but you should know the number of columns there are or at least where the filtering criteria columns are positioned...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1