MsgBox if Slicer item not selected

  • Good evening OzGrid community,


    I am new to this community and would like to thank you in advance for any assistance.


    Before I post my question, and, as a courtesy to the Mr.Excel.com community, I did post a similar post in their forum but unfortunately it went unanswered. The question I am posing here is a bit similar but it addresses another issue.


    So, here it goes - I have a slicer in which I have the following code:



    Essentially, the code loops through the "Slicer_DATE" slicer items, grabs the selected item, and, inserts the slicer item information into the "RegisterDate" named range cell. Now, the code, as is works great. However, what I would like the code to do (already tried to no avail) is to return a message box alerting the user if they have not selected an item and exit the subroutine.


    If I used the line:

    Code
    If sItem.Selected = False Then Msgbox MyMsg

    Though I do not receive an error message, the code will fire the message box but, it will still insert the first value of the slicer into the named range.


    Please let me know if further clarification is needed. I am super, super grateful for any assistance.


    Thanks again.

  • Re: MsgBox if Slicer item not selected


    Maybe

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: MsgBox if Slicer item not selected


    Hello KjBox!


    First things first: I apologize for not responding promptly to your suggestion. Turns out that my workbook got corrupted and I had to start from scratch again. At any rate, I got to the point of using the slicer code you graciously suggested and unfortunately it did not work.


    It's interesting to, because an error is never fired and the code executes as though there was not an "Else - No Slicer item selected" in the code though it is. I am still at a loss. It seems that a "False" value is completely overlooked by the code. Again, I sure do appreciate your assistance.


    If there is anyone else that may have encountered this "error" and has a solution please let me know. I would greatly appreciate it. I'll check out other forums to see what I can find.

  • Re: MsgBox if Slicer item not selected


    Quote from KjBox;796149

    Maybe


    I got it! I got it! All your code needed was a "Not" in the If statement!! I REALLY hope someone else can benefit from this. Thanks again KjBox

  • Re: MsgBox if Slicer item not selected


    Your welcome, pleased you got it to work for you.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!