Pause a script

Snoopy

New Member
Joined
Apr 28, 2002
Messages
12
I have a macro in which I want to include a code to halt or freeze the steps for 15 seconds then continue without any user intervention. Excel help wasn't that helpful. This is as far as I have made it:

Sub Viewit()
'
' Macro
'
'

Application.ScreenUpdating = False
Sheets("View").Visible = True
Sheets(Array("FinalReport", "Alloc Rates", "Variances", "Misc")).Select
Sheets("FinalReport").Activate
ActiveWindow.SelectedSheets.Visible = False
Sheets("View").Select
ActiveWindow.Zoom = 200
Application.ScreenUpdating = False
With ActiveWindow
.DisplayGridlines = False
.DisplayHeadings = False
End With
Application.ScreenUpdating = True

'I want to pause the script for 15 seconds at this point


Application.ScreenUpdating = False
With ActiveWindow
.DisplayGridlines = True
.DisplayHeadings = True
End With
Application.ScreenUpdating = True
ActiveWindow.Zoom = 100
Sheets("View").Visible = True
Sheets("Misc").Visible = True
Sheets("Variances").Visible = True
Sheets("Alloc Rates").Visible = True
Sheets("FinalReport").Visible = True
Sheets("View").Select
ActiveWindow.SelectedSheets.Visible = False
Application.Goto Reference:="Go2BUTTONS"
Application.ScreenUpdating = True

End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Put this in your code to get a 15 second pause:

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 15
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,770
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top