+ Reply to Thread
Results 1 to 4 of 4

Warning box problem

  1. #1
    Registered User
    Join Date
    12-18-2004
    Posts
    43

    Arrow Warning box problem

    Upon the push of a button, a message appears. There is a yes/no select option. Problem is, both buttons perform the same function (that of the yes button). I need the "no" button to stop the macro and take me back to the jump off point. The macro reads:

    Public Sub Message()

    Dim Msg, Style, Title, Response, MyString
    Msg = "If you select YES all summary information will be erased. Select NO to return to Control Panel." ' Define message.
    Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
    Title = "WARNING" ' Define title.

    ' Display message.
    Response = MsgBox(Msg, Style, Title)
    If Response = vbYes Then ' User chose Yes.
    Range("K7:AJ25").Select
    ActiveWindow.ScrollColumn = 7
    Selection.Copy
    Application.CutCopyMode = False
    Selection.ClearContents ' Perform some action.
    Else ' User chose No.
    MyString = "No" ' Perform some action.
    End If
    End Sub

  2. #2
    Forum Contributor
    Join Date
    11-29-2003
    Posts
    1,203
    Hi Neb,

    The problem is not clear to me. The code seems to work (sort of). If I select Yes, it clears the range "K7:AJ25"; if I select No, it does NOT clear the range.

    Not sure why you have the "Copy" command in there since you don't seem to be pasting it anywhere.

    What is it that you want the "No" to do, other than nothing (which is what it does now)?

    - Pete

  3. #3
    Registered User
    Join Date
    12-18-2004
    Posts
    43

    message box problem

    I want it to return to the sheet. It doesn't do that. The copy is to hold in memory so that if they change their mind, they can paste the info back into the sheet.

    Thanks for taking a look.

    Jan

  4. #4
    Registered User
    Join Date
    12-18-2004
    Posts
    43

    message box problem

    Oh yes, I forgot to tell you that on my machine, it carries out the process whether I hit yes or no. I want no to stop and return to the main sheet (sheet 2).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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