If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Pause sub

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-13-04, 15:01
Rodrigo Mota Rodrigo Mota is offline
Registered User
 
Join Date: Dec 2004
Posts: 28
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
Reply With Quote
  #2 (permalink)  
Old 12-14-04, 03:18
DavidCoutts DavidCoutts is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 12-14-04, 11:41
Rodrigo Mota Rodrigo Mota is offline
Registered User
 
Join Date: Dec 2004
Posts: 28
Thanks Dave

That was exactly what I was looking for

Cheers
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On