+ Reply to Thread
Results 1 to 3 of 3

Cancel and End Sub Double Anomaly

  1. #1
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    258

    Cancel and End Sub Double Anomaly

    I'm trying to exit my macro if I click 'Cancel' in an input box :

    Please Login or Register  to view this content.
    Both of these work , and exit the macro correctly when I click cancel.

    Unfortunately , if the number I enter into the second box happens to be a zero , it exits also.

    Is there a way to have a Double variable cancel when I click the button , but allow me to enter a zero?

    Grateful for any help.

    Using Excel , Word and Access 2003 - January 2021

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    2016 primarily
    Posts
    5,832

    Re: Cancel and End Sub Double Anomaly

    You'd be better off using named arguments rather than positional - you've actually got the Type value in the wrong place. You can use a variant for the return, then test its type, since Cancel still returns False:

    Please Login or Register  to view this content.
    Rory
    I drink, and I know things

  3. #3
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    258

    Re: Cancel and End Sub Double Anomaly

    Ok thanks for getting back. I see that's a better way to do it. Thanks!



+ 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] Big date anomaly
    By heytherejem in forum Excel General
    Replies: 2
    Last Post: 02-26-2018, 12:17 PM
  2. Replies: 2
    Last Post: 11-28-2014, 07:09 AM
  3. [SOLVED] If i click cancel then cancel the operation
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2014, 12:20 AM
  4. [SOLVED] Disabling 'Cancel' option when saving work (Yes/No/Cancel)
    By jsmarsha@wisc.edu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-11-2006, 04:35 PM
  5. Cancel button to cancel the whole macro
    By excelnut1954 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-17-2006, 04:30 PM
  6. Printing Anomaly
    By Otto Moehrbach in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-26-2005, 11:05 AM
  7. Cancel Macro is user selects 'cancel' at save menu
    By Mark in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-06-2005, 01:06 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