Filter for data and dates in the same column

  • Hi, I need to filter for 'Unclassified' and all last months dates in the same column. I tried the below code but it doesn't work, cheers. PS. this is completely different to my other post.....!

    Code
    1. Range("A1").AutoFilter Field:=8, Criteria1:=Array("Unclassified"), Operator:=xlFilterValues, Criteria2:=Array(xlFilterLastMonth), Operator:=xlFilterDynamic
  • The criteria requires OR ...


    Code
    1. Sub UnClassAndDate()
    2. Range("A1:A10").AutoFilter Field:=1, Criteria1:="=Unclassified", Operator:=xlOr, Criteria2:="=24 02 2021"
    3. End Sub

    Hope this will help

    :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • I basically need these two combined...is it called in an Array.

    Code
    1. Range("A6").AutoFilter Field:=7, Criteria1:="Unclassified"
    2. Range("A6").AutoFilter Field:=7, Criteria1:=xlFilterLastMonth, Operator:=xlFilterDynamic
  • The trouble is that you are mixing Text and Numbers in the very same column ...


    Will have to think of how to bypass this issue to meet your ' combined ' criteria ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • Actually never experienced to create a UDF to be used as criteria in AutoFilter ...


    Meanwhile, attached is a ' dynamic ' shortcut ...


    Hope this will help

    :)

    Files

    • Test OZ 2.xlsm

      (22.52 kB, downloaded 50 times, last: )

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • Wow....a bit too complicated for me.....I need VBA.


    Maybe I will filter for 'Unclassified'...copy and paste that to a new sheet, then return to my data and filter for 'Last' month and copy and paste that with the 'Unclassified' using VBA....I have done something similar before.

  • Difficult for me to see what you find ' complicated ' ...


    Just out of curiosity ... would you be happy with a Filter by Cell Color ...? (see attached)


    As an alternative ....(to see if a VBA might help ) could you post the actual structure of your real-life sheet ...

    Files

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • Once you have tested the Filter by Cell Color ... you will let me know if it solves your initial question ... or not ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • Glad you could fix your problem :)


    Thanks for your Thanks ...AND for the Like :thumbup:

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)