Share via

VBA to "exit sub" when "data validation" error is triggered

Anonymous
2023-11-02T20:54:50+00:00

I have a cell with assigned Data Validation criteria. If the user inputs an erroneous value it returns the “Stop” Error Alert with the Retry/Cancel/Help buttons.

Upon entering data in the cell another routine is triggered. Is it possible that if the user selects the “Cancel” option the remaining routine would also be cancelled? That is, something like Exit Sub upon selecting Cancel.

=========================================================================

EDIT - 

My current issue is in regards to Data Validation criteria.  I have a cell with an associated dropdown list.  All works fine if the user only selects an option (date) from the list.  However, I want the user to also be able to “keyin” a date.  Again this is fine if the user keys in an acceptable date.  However, if the user keys in an unacceptable date (i.e., one that is not in the list) the Data Validation’s “stop” error message pops up with the Retry/Cancel /Help buttons, which is great.  What I want is if the user selects “Cancel” I want the routine to truly stop (i.e., something like an If/Then with an Exit Sub).

My question – is there a way to stop/exit a Sub-Routine if/when the user clicks on the Data Validation’s Stop error’s “Cancel” button?

Thanks,

*******

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-11-03T18:53:36+00:00

    Hi DanielGuil

    Greetings!

    Thank you for posting in Microsoft Community.

    As much as we love to answer your query here right away, it appears that it is beyond our expertise. It is more complex than what we normally discuss here in the community. In order for you to get the accurate information you need, kindly go to Microsoft Q&A and post your query. They are experts with this kind of concern.

    I will also leave this thread open for our Excel Experts to join.

    Sincerely

    Juhn Jac

    Microsoft Forum Moderator

    Was this answer helpful?

    0 comments No comments