+ Reply to Thread
Results 1 to 8 of 8

Creating a warning message if a filter doesn't exist.

  1. #1
    Registered User
    Join Date
    08-10-2017
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    17

    Creating a warning message if a filter doesn't exist.

    Hey guys, so I'm looking to add a little clause at the end of some of my macros.

    First, all the macros due is apply some filters to a slicer. For example:

    "Shipment late" = True
    "Shipment verified" = False....

    Etc. Etc.

    What I'd like to do, is add a lump of code at the end that provides a message if the filters don't exist. For example, if I wanted to click the button that showed me which parts are running late, but NO Parts are running late, it would just say "No late parts found."


    The way my macros work is that I have a column which decides, using IF formulas, if a part is late. So - Is it possible to write some VBA that either A: Checks the slicer for the late option or B: Checks the column where the formula is (Let's just call it 'A' for now)

    Thanks in advance!

  2. #2
    Registered User
    Join Date
    11-19-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    2016
    Posts
    57

    Re: Creating a warning message if a filter doesn't exist.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-10-2017
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    17

    Re: Creating a warning message if a filter doesn't exist.

    Thanks for the reply! At the moment I get the error message "Can't find project or library" and it highlights the "CountIf"

    Any ideas? Also, for ease of swapping things in correctly, could we write it as if the column was A and the phrase "Late Part"?

    For example, I re-wrote it like so, but I am not sure if the format is correct! (I'm very new to VBA)

    If CountIf(Columns("A:A"), "Late Part") = 0 Then MsgBox "No late parts found."

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Creating a warning message if a filter doesn't exist.

    I think Doob probably expected you to preface the Countif. i.e.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Registered User
    Join Date
    08-10-2017
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    17

    Re: Creating a warning message if a filter doesn't exist.

    Thanks! Made some progress that way. I'm trying to get it to work for multiple options, but it seems to be making a message box every time (even if the options exist).

    Here's what I've got written out at the moment (Yes, U is definitely the correctly column and yes, the text in quote marks is exact i.e. same number of spaces etc. )

    Please Login or Register  to view this content.
    Last edited by Stale_Buns; 04-24-2018 at 09:59 AM.

  6. #6
    Registered User
    Join Date
    11-19-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    2016
    Posts
    57

    Re: Creating a warning message if a filter doesn't exist.

    try this:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    08-10-2017
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    17

    Re: Creating a warning message if a filter doesn't exist.

    I'm about to leave the office, but this looks like it has worked, I will double check tomorrow and return to close (Or ask another question!)

    Thanks

  8. #8
    Registered User
    Join Date
    08-10-2017
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    17

    Re: Creating a warning message if a filter doesn't exist.

    Not sure how I close a thread... But all is well!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Inserting filter into pivot table via macro errors if filter doesn't exist.
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2018, 10:24 AM
  2. Assigning pivot filter that doesn't exist breaks macro
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2017, 06:22 PM
  3. Replies: 2
    Last Post: 07-25-2017, 02:23 AM
  4. Filtering for a certain date and Having a message pop up if date doesn't exist
    By frenchgreek in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2013, 03:38 PM
  5. [SOLVED] Need help creating a Warning Message with two if statements
    By mo4391 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-19-2013, 03:58 PM
  6. [SOLVED] Creating Message Box Warning
    By Mariner in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-21-2006, 08:45 AM
  7. Replies: 4
    Last Post: 06-18-2006, 01:10 PM

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