Closed Thread
Results 1 to 3 of 3

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:

    [Private Sub Worksheet_Change(ByVal Target As Range)
    Dim Y
    If Target.Cells.Count > 1 Then Exit Sub
    If Not Intersect(Target, Range("I3:O200")) Is Nothing Then
    With Target
    If IsNumeric(.Value) And Not IsEmpty(.Value) Then
    Y = Target.Row
    Range("D" & Y).Value = Range("D" & Y).Value + Range("I" & Y).Value + Range("K" & Y).Value _
    + Range("M" & Y).Value + Range("O" & Y).Value
    End If
    End With
    End If
    If Target.Cells.Count > 1 Then Exit Sub
    If Not Intersect(Target, Range("I3:P200")) Is Nothing Then
    With Target
    If IsNumeric(.Value) And Not IsEmpty(.Value) Then
    Y = Target.Row
    Range("R" & Y).Value = Range("R" & Y).Value + Range("P" & Y).Value + Range("N" & Y).Value _
    + Range("L" & Y).Value + Range("J" & Y).Value
    End If
    End With
    End If
    End Sub]

    When this VBA is done I want a MsgBox:

    [Dim Sum As Double

    For Each Sh In ThisWorkbook.Worksheets
    Sum = Sum + Application.WorksheetFunction.Sum(Sh.Range("Q3:Q200"))
    Next
    If Sum > 0 Then MsgBox "Text"]

    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
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,038

    Re: MsgBox vbYesNo with several VBA's

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Never use Merged Cells in Excel

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,038

    Re: MsgBox vbYesNo with several VBA's

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    http://www.excelforum.com/excel-prog...eral-vbas.html

    Thread Closed.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Calling macro and ignore vbYesNo msgbox
    By exceere in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-25-2014, 11:04 PM
  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