Sub Main_Prg()
Speedup_Macro True
'''' Your Code
'''
'''end of code
Speedup_Macro False
End Sub
Function Speedup_Macro(Chk As Boolean)
If Chk = True Then
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Application.DisplayStatusBar = True
Application.StatusBar = "Macro is working....pls wait "
Else
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Application.DisplayStatusBar = True
Application.StatusBar = ""
End If
End Function
Description -
Application.DisplayAlerts
The default value is True. Set this property to False if you don't want to be disturbed by prompts and alert messages while a macro is running; any time a message requires a response, Microsoft Excel chooses the default response.
When using the SaveAs method for workbooks to overwrite an existing file, the 'Overwrite' alert has a default of 'No', while the 'Yes' response is selected by Excel when the DisplayAlerts property is set equal to False.
Application.ScreenUpdating
Turn screen updating off to speed up your macro code. You won't be able to see what the macro is doing, but it will run faster.
Remember to set the ScreenUpdating property back to True when your macro ends.
Sunday, December 5, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment