Results 1 to 3 of 3

Thread: Pause sub

  1. #1
    Join Date
    Dec 2004
    Posts
    28

    Unanswered: Pause sub

    hi

    Is there any way to pause a sub, so something else can be done in a excel sheet and then after some time or for example a sheet get focus to continue that sub

    Thanks

  2. #2
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067
    For a length of time wait you can use

    Application.OnTime

    or to completly halt the macro just stop it, write a text command somewhere in your workbook so that the new event will run only when this happens

    i.e.

    Code:
    'at end of your sub
        Worksheets("Sheet2").Range("A1").Value = "GO"
    End Sub
    
    'in sheet2
    Private Sub Worksheet_Activate()
        If Not Range("A1").Value = "GO" Then Exit Sub
        MsgBox "Run Here"
    End Sub
    Dave

  3. #3
    Join Date
    Dec 2004
    Posts
    28
    Thanks Dave

    That was exactly what I was looking for

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •