Consulting

Results 1 to 6 of 6

Thread: Help with filter by date

  1. #1

    Help with filter by date

    I am trying to filter for dates before today. However, my code below is just simply not working. It runs but it does not seem to be filtering. Anybody know whats wrong with the code below? Thanks!

    Sheets(1).Range("A1:AC1").AutoFilter Field:=11, Criteria1:="<" & CLng(Date)

  2. #2
    May be those lines help you (Not Testes)
    Dim myDate As Date
    myDate = DateSerial(Year(myDate), Month(myDate), Day(myDate))
    Sheets(1).Range("A1:AC1").AutoFilter Field:=11, Criteria1:="<" & myDate

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    No balls… quite so.

  4. #4
    I tried using your code above. It kind of spits out the same results. I think it sort of skips over that line without doing anything.

  5. #5
    I double checked and as it turns out your code actually works just fine. I just made a small organization error. Thanks!

  6. #6
    You're welcome. Glad I can offer some help

Posting Permissions

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