Results 1 to 6 of 6

Thread: Anyone have any idea on this code to speed up macros

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Mentor
    Joined
    Feb 2016
    Posts
    382
    Location

    Anyone have any idea on this code to speed up macros

    application.Visible = False 'Run Code Application.Visible = True

    can this code above be added to the below code

    Public CalcState As Long
    Public EventState As Boolean
    Public PageBreakState As Boolean
    
    
    Sub OptimizeCode_Begin()
    
    
    Application.ScreenUpdating = False
    
    
    EventState = Application.EnableEvents
    Application.EnableEvents = False
    
    
    CalcState = Application.Calculation
    Application.Calculation = xlCalculationManual
    
    
    PageBreakState = ActiveSheet.DisplayPageBreaks
    ActiveSheet.DisplayPageBreaks = False
    
    
    End Sub
    
    Second Piece of VBA Code
    Sub OptimizeCode_End()
    
    
    ActiveSheet.DisplayPageBreaks = PageBreakState
    Application.Calculation = CalcState
    Application.EnableEvents = EventState
    Application.ScreenUpdating = True

    Last edited by Paul_Hossler; 01-06-2019 at 01:51 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •