Results 1 to 10 of 15

Thread: Do Not AutoFilter If Data Does Not Exist

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    If

    dDate and the date you are filtering for (today?) is exactly the same, then it shouldn't be a problem. If the problems still persists, can you attach a sample file.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  2. #2

    still not working :(

    Thanks Excel Fox, yes I see your point. dDate (today's date) and the column I am filtering are the same so I don't know what i'm doing wrong. I think I have missed something silly.

    Code:
    Sub todaysdels()
    
        dDate = Date
        
        If Application.WorksheetFunction.CountIf(Range("U3:U500"), dDate) Then
         Range("A2").AutoFilter field:=20, Criteria1:=dDate
    Else
        MsgBox "No delivery for today!", vbOKOnly
     End If
        
    End Sub
    I tried attaching my file but the size (849 Kb) exceeds the formum limit for xls files.


    https://www.youtube.com/@alanelston2330/featured
    Last edited by DocAElstein; 09-13-2023 at 11:23 AM.

  3. #3

    file attached

    Attached as ZipAttachment 406

Similar Threads

  1. Replies: 2
    Last Post: 09-24-2012, 11:19 PM
  2. Checking Table Exist in Access Database or Not
    By littleiitin in forum Excel and VBA Tips and Tricks
    Replies: 1
    Last Post: 11-16-2011, 04:32 PM
  3. AutoFilter by Multi Color
    By Admin in forum Download Center
    Replies: 0
    Last Post: 09-08-2011, 07:17 AM

Tags for this Thread

Posting Permissions

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