Results 1 to 10 of 15

Thread: Do Not AutoFilter If Data Does Not Exist

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Do Not AutoFilter If Data Does Not Exist

    Hello ExcelFox Forum users. My first post, how exciting.

    OK well I am a beginner i'm afraid so I hope I don't dumb down the water of this site too much

    I don't work with code but at work I have created many spread sheets in order to keep a record of international shipments coming into the UK.
    I have written many Macros and formulas on these spreadsheets but Im just having one problem I cant seem to get on top of. I would be very grateful if you kind people would help me.

    My spreadsheet has a column which is shows a date. This date is when the container delivered to the customer in UK. I run a macro triggered by a button which filters the column to the current date. Therefore when run on the date of delivery is shows "Deliveries for today" This is fine but when there are no deliveries that day i.e. today's date is not in any cell in this specific column then it filters and nothing is displayed. Because the spreadsheet goes out to the customer I think this looks a little messy. Instead, if there are no deliveries on the day I would like the 'msgbox' to pop up and say "there are no deliveries today" instead of just filtering so it just shows empty, non active rows. I have tries many bits of code over the last few weeks but can't get any to work.

    My code for the filter is below. I need perhaps an 'If' statement so if after filter this is no active rows then msgbox "No deliveries today"

    Code:
    Sub todaysdels()
    
        dDate = Date
        
        Range("A2").AutoFilter field:=20, Criteria1:=dDate
        
    End Sub
    I hope I have explained correctly. Thanks.
    Xander1981
    Last edited by Admin; 10-13-2012 at 08:23 PM. Reason: code tag added

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
  •