+ Reply to Thread
Results 1 to 3 of 3

Call another Macro or Stop Macro Based on MsgBox Yes or No

  1. #1
    Registered User
    Join Date
    01-25-2012
    Location
    Tucson, AZ, USA
    MS-Off Ver
    Excel 2007
    Posts
    12

    Call another Macro or Stop Macro Based on MsgBox Yes or No

    I'm fairly new to VBA Code and am stuck. I want to run a Macro (I'll refer to it as "Call Macro" in this post) that calls about 10 different Macros. The Call Macro works fine, as does the separate Macros it calls. What I'm trying to do is create a Procedural Macro linked to a button so I can click the button and receive Message Boxes to remind me to do certain things before continuing with the Call Macro. The button works fine but the Procedural Macro is hanging me up. There are four different steps I need to make sure are completed before I run the Call Macro. So I want the MsgBox to have a reminder message and a "Yes" and "No" button. If I click Yes, I want it to call the next reminder (there are 4 in all). If I click No, I want another MsgBox to show and to end the Macro. In the two macros that follow, the first works fine. The second, I have written and rewritten too many times to count, experimenting with If-Then, If-Then-Else, If-Then-IfElse, etc. but have been unsuccessful at getting the exact results I want. Please help!

    Sub DOUBLE_CHECK_PROCEDURE1()
    '
    '
    '
    '
    Dim BlanksAndSingles As String
    BlanksAndSingles = MsgBox("Have all blanks been zeroed and single line items been doubled?", vbYesNo, "NO BLANKS")
    Call DC_PROCEDURE1_IF


    End Sub

    Sub DC_PROCEDURE1_IF()
    '
    '
    If BlanksAndSingles = vbNo Then
    MsgBox "Make Necessary Corrections, then Return Here"
    Exit Sub
    End If
    If BlanksAndSingles = vbYes Then
    Call DOUBLE_CHECK_PROCEDURE2
    End If

    End Sub

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Call another Macro or Stop Macro Based on MsgBox Yes or No

    Hello There,

    Try this.


    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-25-2012
    Location
    Tucson, AZ, USA
    MS-Off Ver
    Excel 2007
    Posts
    12

    Talking Re: Call another Macro or Stop Macro Based on MsgBox Yes or No

    You Rock! Thanks. I figured it was something simple. The Option Explicit is important. Thanks, again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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