+ Reply to Thread
Results 1 to 6 of 6

Insert function to 'Cancel' Button in InputBox

  1. #1
    Registered User
    Join Date
    02-07-2014
    Location
    Rio de Janeiro
    MS-Off Ver
    Excel 2016, 365
    Posts
    24

    Insert function to 'Cancel' Button in InputBox

    Hi,

    I have the code below,
    That code call some InputBoxes in sequence, that be filled with ocrrectly information like name, cell phone, date of purchase, etc. (sheet is in portuguese)

    But I want to give a function for 'Cancel' Button, because actually if we click on cancel Button, the macro skip to the next inputbox,

    I want to click in Cancel Button, and Exit Sub, I used this Tip for example

    Please Login or Register  to view this content.

    But if we do not fill the Text field, the Macro Exit Sub Too

    Some fields are optional, so for this i search for a solution

    Click in Cancel Button and Exit Sub

    Somebody can help me?

    Please Login or Register  to view this content.
    Last edited by leleco; 05-16-2014 at 11:59 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646
    Try this.

    Please Login or Register  to view this content.
    By the way, why not use a userform instead of multiple inputboxes?
    If posting code please use code tags, see here.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Insert function to 'Cancel' Button in InputBox

    Hello leleco,

    The InputBox returns an empty string when the user clicks Cancel. Your macro would need to check each output string before assigning it to the cell.

    Will the action for Cancel always be the same?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Insert function to 'Cancel' Button in InputBox

    Oops, I was thinking of Application.InputBox.

  5. #5
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Insert function to 'Cancel' Button in InputBox

    Hi leleco,

    Try the following Macros as a first attempt based on your original input. Each data line has the option of CANCEL or CONTINUE when the User selects the CANCEL button (or input is BLANK or SPACES). It also has the option of putting in a SEED value for each data input which could be useful if you're editing existing data.

    Lewis

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-07-2014
    Location
    Rio de Janeiro
    MS-Off Ver
    Excel 2016, 365
    Posts
    24

    Re: Insert function to 'Cancel' Button in InputBox

    Hi Metzger,

    You Help me a Lot,

    The problem was solved

    Thank You
    Last edited by leleco; 05-16-2014 at 11:58 AM.

+ 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. InputBox and Cancel
    By michaelaindia in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-24-2012, 04:32 AM
  2. Cancelling an inputbox if blank input or cancel button is pressed
    By kathhying in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-01-2011, 12:07 PM
  3. add cancel button to inputbox
    By SarahPintal in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2011, 02:27 AM
  4. [SOLVED] Inputbox cancel button error.
    By abhay_547 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-05-2010, 06:27 AM
  5. activate cancel button in a inputbox
    By mania112 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-19-2009, 07:09 AM

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