+ Reply to Thread
Results 1 to 10 of 10

MsgBox vbYesNo with several VBA's

  1. #1
    Registered User
    Join Date
    01-21-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    25

    MsgBox vbYesNo with several VBA's

    Hello,

    I have several working VBA codes.
    First I want to work this code working when "Yes" is selected in a vbYesNo MsgBox:

    Please Login or Register  to view this content.
    When this VBA is done I want a MsgBox:

    Please Login or Register  to view this content.
    When I click "Ok" in this MsgBox it should be great if (I3:I200; K3:K200; M3:M200 and O3;O200) will be cleared of all values.

    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    423

    Re: MsgBox vbYesNo with several VBA's

    First I want to work this code working when "Yes" is selected in a vbYesNo MsgBox:
    Does this do what you want?

    Please Login or Register  to view this content.
    When I click "Ok" in this MsgBox it should be great if (I3:I200; K3:K200; M3:M200 and O3;O200) will be cleared of all values.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-21-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    25

    Re: MsgBox vbYesNo with several VBA's

    partially.

    I have a commandbutton when I click this button I want to see the MsgBox vbYesNo (text: "Would you like to keep your inputs?")
    When I click yes the first macro should run.

    When this is done (if its possible) I automaticaly want to receive a MsgBox (with the result of my second macro).

    Afterwards I want the given range back cleared so everything is ready for the following input.

    I hope you can uderstand my question.

  4. #4
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    423

    Re: MsgBox vbYesNo with several VBA's

    I have a commandbutton when I click this button I want to see the MsgBox vbYesNo
    Then the code should not be in the Worksheet_Change event, but in the CommandButton<name>_Click event. There is no 'Target' anymore however, so I've changed 'Target' to 'Selection'.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-21-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    25

    Re: MsgBox vbYesNo with several VBA's

    The code is giving a few problems.

    I receive the MsgBox's but the codes will not run. The values in columns D and Q does not appaer and the ClearContents is giving an error.

  6. #6
    Registered User
    Join Date
    01-21-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    25

    Re: MsgBox vbYesNo with several VBA's

    Error: Object variable or With block variable not set

  7. #7
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    423

    Re: MsgBox vbYesNo with several VBA's

    Can you upload the spreadsheet?

  8. #8
    Registered User
    Join Date
    01-21-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    25

    Re: MsgBox vbYesNo with several VBA's

    Here is the spreadsheet
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    423

    Re: MsgBox vbYesNo with several VBA's

    I see my mistake - there needs to be another For/Next loop after the msgbox. Try this:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    01-21-2015
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    25

    Re: MsgBox vbYesNo with several VBA's

    Yes indeed the ClearContents works.

    But the first part still doesn't work. The part were columns "D" and "R" will count the values in columns "I" till "O"

+ 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. MsgBox vbYesNo with several VBA's
    By Mr_Focal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2015, 04:45 AM
  2. Msgbox vbYesNo if then
    By Swoootie in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-24-2014, 09:22 AM
  3. [SOLVED] Having trouble with msgbox vbYesNo
    By Tayjayt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-25-2013, 12:55 AM
  4. msgbox vbyesno
    By newbielondon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-18-2012, 06:25 PM
  5. MsgBox vbYesNo and Exit Sub
    By Monkeyboyz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-30-2010, 12:46 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