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 > Pausing a macro

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-03-11, 03:02
LukeBrims LukeBrims is offline
Registered User
 
Join Date: May 2011
Posts: 7
Pausing a macro

I have set up a stopwatch in Excel using the code below (Please excuse the code - I am new so have been using various bits of code I have found on the internet)

Public Sub startClock()

Dim start

start = Timer
Do While stopped = False
DoEvents
Worksheets("ALL@1").Range("E3").Value = Int((Timer - start + 0.5) / 60 / 60)
Worksheets("ALL@1").Range("F3").Value = Int((Timer - start + 0.5) / 60)
Worksheets("ALL@1").Range("H3").Value = (Timer - start) Mod 60
Worksheets("ALL@1").Range("I3").Value = (Timer - start + 0.5) - (Int(Timer - start + 0.5))
Loop

End Sub

Private Sub cmdStart1_Click()
startClock
End Sub

Private Sub cmdStop1_Click()
stopped = True
End Sub


What I would like to do is add a "Pause" function.

If anyone could help me with this it would be greatly recieved. Also please bear in mind I am very new to this and may need to put it in very simple terms.
Reply With Quote
  #2 (permalink)  
Old 06-12-11, 12:33
apr pillai apr pillai is offline
Registered User
 
Join Date: Jan 2009
Location: Kerala, India
Posts: 107
Pausing a macro

If you are trying to pause the execution of the macro in the middle somewhere then insert a STOP statement on a separate line.
__________________
http://www.msaccesstips.com (Learn MS-Access Tips & Tricks)
Learn Advanced MS-Access Programming with sample VBA Code.
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