+ Reply to Thread
Results 1 to 4 of 4

Yes/No message box - If no execute code

  1. #1
    Forum Contributor
    Join Date
    07-02-2013
    Location
    abbots langley
    MS-Off Ver
    Excel 2010
    Posts
    316

    Yes/No message box - If no execute code

    Hi Forum

    I am trying to execute a code based on a yes no message box but struggling a bit as I have 3 parts to it.

    If Yes is selected then I need to exit the sub, this bit is fine.
    If no is selected and Cell B22 =0 again exit sub, this part is fine.

    It is the third step i am struggling with:

    If No is selected and Cell B22 =1 then execute the rest of the code.


    Please Login or Register  to view this content.
    Appreciate your help with this.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Yes/No message box - If no execute code

    Michelle1,

    First, let me point out you have 2 exit sub scenarios where sheet7 would remain unprotected, screenupdating left off, and sheet1 remain visible... maybe that's on purpose, but uncommon so I wanted to point it out. As far as the simplest solution to your mentioned problem, you have an else too many in there... you don't need the second else nor if MSG1 = vbNo... try this:

    Please Login or Register  to view this content.
    I took the liberty of cleaning up a bit of the code in terms of layout.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Contributor
    Join Date
    07-02-2013
    Location
    abbots langley
    MS-Off Ver
    Excel 2010
    Posts
    316

    Re: Yes/No message box - If no execute code

    HI Arkadi

    Thankyou so much, works perfectly and thankyou for tidying the code.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Yes/No message box - If no execute code

    Happy to help
    Thanks for the rep!
    If I could ask one thing? Please mark the thread as solved if you are satisfied with the solution? 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. VB code does not execute
    By Dummy99 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-03-2016, 02:18 PM
  2. code to execute a keyboard shortcut or to execute a toolbar button
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2015, 12:16 PM
  3. [SOLVED] Execute Macro on no response from message box
    By VillaLion in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-21-2014, 12:10 PM
  4. VBA code to execute for next row
    By GUERCHARD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-22-2013, 10:05 AM
  5. Sending a message to the user while continuing to execute
    By SgtSunshine in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-02-2010, 10:28 AM
  6. Execute Code
    By gti_jobert in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-02-2006, 05:40 AM
  7. Execute warning message
    By Pat in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2006, 07:15 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