+ Reply to Thread
Results 1 to 4 of 4

Canceling on Input Box

  1. #1
    Registered User
    Join Date
    03-11-2019
    Location
    Woodland Hills
    MS-Off Ver
    2016
    Posts
    2

    Canceling on Input Box

    Hi All,

    i don't know anything about VBA, but I was able to locate a VBA script that works to fit my needs. The only thing that does not work is the "Cancel' button that populates on the Input boxes. Can someone help me fill in the gap for this?

    ----------
    Please Login or Register  to view this content.
    Last edited by jeffreybrown; 03-11-2019 at 05:53 PM. Reason: Please use code tags when posting code!

  2. #2
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,491

    Re: Canceling on Input Box

    After the code for the inputboxes put statements like this
    you did not say what you want to happen if cancel is used. so I build to options.

    The first line of AgGrp will stop executing the rest of the macro if cancel is pressed.
    The second line for RpDate will use the last day of last month as reporting date and continue the macro with that date

    Please Login or Register  to view this content.
    so it is up to you if that is suitable or that you need other things to happen when cancel is used.

  3. #3
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Canceling on Input Box

    Hi, welcome to the forum.
    If I understand you correctly you need to test if the user entered something of pressed Cancel?

    You will need to add two tests
    Firt one is check if AgGrp has been entered

    First Dimension ALL your variables

    Please Login or Register  to view this content.
    What this does is check if anything has been entered, if the user presses X (top right) then it's Canceled and the value is FALSE and this a Boolean (True or False)

    If tha type of answer is a Boolean the it's false so it exist the sub

    Hope this helps
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  4. #4
    Registered User
    Join Date
    03-11-2019
    Location
    Woodland Hills
    MS-Off Ver
    2016
    Posts
    2

    Re: Canceling on Input Box

    You da man Roel!

    Thank you Very much.

    Thanks, Keebellah!

+ 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. [SOLVED] conditional self canceling macro
    By gt4udish in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2015, 06:56 PM
  2. Canceling a Print Job
    By EdWoods in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-14-2013, 08:02 PM
  3. canceling sorting function
    By Vogelmann in forum Excel General
    Replies: 2
    Last Post: 10-24-2012, 07:49 AM
  4. BeforeClose Event - MsgBox Yes No - is not canceling
    By ker9 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-03-2012, 11:51 AM
  5. Loop in canceling of event
    By AnthonyWB in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-30-2011, 07:14 PM
  6. Canceling out zeros
    By esupply in forum Excel General
    Replies: 5
    Last Post: 03-12-2010, 05:07 PM
  7. Canceling items from a sheet
    By Skiman in forum Excel General
    Replies: 9
    Last Post: 03-02-2008, 09:12 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