Question : Stopping a VBA Macro

I would like to add an option for a user to stop the execution of a macro.  I have a macro that executes from a button in Excel, and runs for about 2-3 mins.  I would like to have a message box or something similar on the screen to allow the end user to Stop or terminate the executing macro.  How can I do this?

Answer : Stopping a VBA Macro

Wel this is te skeletal proigramming.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
Sub RunProcess()
For MyTab = 0 To TabCount
    UserForm1.TextBox1.Text = MyTab
    UserForm1.Show vbModeless
    If UserForm1.Interrupt Then
        If MsgBox("Do you want to continue with " & MyTab & "?", vbYesNo) = vbYNo Then
          Exit Sub
        End If
    End If
    MyProcess MyTab
Next MyTab
End Sub
'In the form
Sub cmdInterrupt_Click()
   Interrupt = True
End Sub
Open in New Window Select All
Random Solutions  
 
programming4us programming4us