+ Reply to Thread
Results 1 to 6 of 6

How do I stop a Macro after "Cancel" is chosen in an input box?

Hybrid View

  1. #1
    Registered User
    Join Date
    11-16-2006
    Posts
    80
    Hi, try:

      
    If Ans = "" Then
          End
    Else
          '...statements
    End If
    HTH,

    mccreaso

  2. #2
    Registered User
    Join Date
    11-16-2006
    Posts
    80
    Quote Originally Posted by mccreaso
    Hi, try:

      
    If Ans = "" Then
          End
    Else
          '...statements
    End If
    HTH,

    mccreaso

    Correction:

      
    If UserEntry1 = "" Then
          End
    Else
          '...statements
    End If

  3. #3
    Forum Contributor stevebriz's Avatar
    Join Date
    09-07-2006
    Location
    Santiago Chile
    Posts
    389
    Another Example:

    msg = ("Enter an account number to highlight.")
    
       UserEntry1 = Application.InputBox(msg, , , , , "", , 1)
       If UserEntry1 <> False Then
      Ans = MsgBox("Would you like to highlight an additional account?", vbYesNo)
       Select Case Ans
           Case vbNo
               Worksheets("R1").Select
               Counter = 0
               EndCounter = 20
               Do Until Counter = EndCounter
                   Range("F6:F28").Select
                   Selection.FormatConditions.Delete
    .........
     End If
    End Sub
    VBA - The Power Behind the Grid

    Posting a sample of your workbook makes it easier to look at the Issue.

  4. #4
    Registered User
    Join Date
    07-19-2006
    Location
    Jamaica
    Posts
    86
    Perfect - it works, but why? Whats the difference?

    /Møller
    --
    M?ller

  5. #5
    Forum Contributor stevebriz's Avatar
    Join Date
    09-07-2006
    Location
    Santiago Chile
    Posts
    389
    have a read of this:
    This explains why.

    http://support.microsoft.com/kb/142141

+ 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