Slow code influences

JoeExcelHelp
5StarLounger
Posts: 1177
Joined: 22 Jul 2013, 18:29

Slow code influences

Post by JoeExcelHelp »

Gentleman this is the only code on my arsenal that runs extremely slow. I was hoping you guys could give it a once over and let me know if anything within it is the cause
or, if another better code or modification option is available
Thank You in advance

Code: Select all

Sub SumHiringPlan1()
    Application.ScreenUpdating = False
    Application.DisplayStatusBar = False
    Application.EnableEvents = False
    With Worksheets("HiringPlan").Range("F19:AC2870")
        .FormulaR1C1 = "=SUMPRODUCT((Data4!R2C1:R7000C1=RC2)*(Data4!R2C2:R7000C2=RC5)*(Data4!R1C3:R1C55=R18C),Data4!R2C3:R7000C55)"
        .Value = .Value
    End With
    Application.EnableEvents = True
    Application.DisplayStatusBar = True
    Application.ScreenUpdating = True
End Sub

User avatar
HansV
Administrator
Posts: 78675
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Slow code influences

Post by HansV »

The code performs more than 1,000,000 multiplications and additions for each of more than 68,000 cells. That will take a lot of time. A fast computer with lots of memory will help...
Best wishes,
Hans