How To increase Speed of VBA Macro?




Ans : We can fasten the execution of macros or VBA Procedures by following the below tips. 
 1) Declare the variables and avoid using 
'Variant' Data Type. 
Ex : 
Dim Filename As String
Dim Age As Integer 

2) Turn Off Screen Updating 
Ex : Application.ScreenUpdating= False 

3) Turn Off Automatic Calculations 
Ex : Application.Calculation= XlManaul '/ Automatic

4) Disable Events
 Ex : Application.EnableEvents= False 

5) Use With Statement 
Ex : 
With WksRpt
 .Range("A1")
.Value="Summary"
 .Range("A1")
.Font.Bold=True 
End With

6) Use vbNullString instead of  " " 
Ex : Wks.Range("A5").Value= VbNullString 

7) Release memory objects at the end of the procedure. 
Ex : 
Set OlApp = Nothing 
Set Counter = 0

Post a Comment

Previous Post Next Post