Increase Macro Speed
Sub Speed_Up_Performance()
Set_Performance_Options
' Use Early Binding Instead of late binding
' Do not use Variant if you can use Long, String data types
' If you want to loop through the documents/workbooks use For each
For Each Doc In Documents
' Do something
Next Doc
ReSet_Performance_Options
End Sub
Function Set_Performance_Options()
' If an updated cell value is necessary for the macro. Then either do not use this or used forced calculation using calculate method
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
End Function
Function ReSet_Performance_Options()
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Function
' ScreenUpdating, Calculation, Early Binding, late binding, Speedup VBA Performance, Optimize VBA Code, Visual Basic Code Optimization
No comments:
Post a Comment