Advertisement
dave3009

PaulFEFF

May 4th, 2020
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Sub MyMacro()
  4.  
  5. 'dim and consts here
  6.  
  7. TurnOffSettings ' turns off settings that slow Excel
  8.    
  9.     ' rest of code here
  10.    
  11.    
  12. TurnOnSettings ' restores Excel settings
  13. End Sub
  14.  
  15.  
  16. Sub TurnOffSettings()
  17. With Application
  18.     .ScreenUpdating = False
  19.     .Calculation = xlCalculationManual
  20.     .EnableEvents = False
  21. End With
  22. End Sub
  23.  
  24.  
  25. Sub TurnOnSettings()
  26. With Application
  27.     .ScreenUpdating = True
  28.     .Calculation = xlCalculationAutomatic
  29.     .EnableEvents = True
  30. End With
  31. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement