How to fast this macro

abidraza

New Member
Joined
Feb 23, 2011
Messages
10
Sub UpdatePurchase()

Sheets("Main").Select

Range("I4:I4203").Formula = "=SUMIFS(Entry!$I$4:$I$65557,Entry!$F$4:$F$65557,Main!E4,Entry!$H$4:$H$65557,Heads!$B$4)"
Range("J4:J4203").Formula = "=SUMIFS(Entry!$J$4:$J$65557,Entry!$F$4:$F$65557,Main!E4,Entry!$H$4:$H$65557,Heads!$B$4)"

Range("L4:L4203").Formula = "=SUMIFS(Entry!$I$4:$I$65557,Entry!$F$4:$F$65557,Main!E4,Entry!$H$4:$H$65557,Heads!$B$5)"
Range("M4:M4203").Formula = "=SUMIFS(Entry!$J$4:$J$65557,Entry!$F$4:$F$65557,Main!E4,Entry!$H$4:$H$65557,Heads!$B$5)"

Range("O4:O4203").Formula = "=SUMIFS(Entry!$I$4:$I$65557,Entry!$F$4:$F$65557,Main!E4,Entry!$H$4:$H$65557,Heads!$B$6)"
Range("P4:P4203").Formula = "=SUMIFS(Entry!$J$4:$J$65557,Entry!$F$4:$F$65557,Main!E4,Entry!$H$4:$H$65557,Heads!$B$6)"

Range("I4:P4203").Calculate

Range("I4:P4203").Copy

Range("I4:P4203").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

End Sub
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Try

Code:
Sub UpdatePurchase()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
With Sheets("Main")

    .Range("I4:I4203").Formula = "=SUMIFS(Entry!$I$4:$I$65557,Entry!$F$4:$F$65557,Main!E4,Entry!$H$4:$H$65557,Heads!$B$4)"
    .Range("J4:J4203").Formula = "=SUMIFS(Entry!$J$4:$J$65557,Entry!$F$4:$F$65557,Main!E4,Entry!$H$4:$H$65557,Heads!$B$4)"
    
    .Range("L4:L4203").Formula = "=SUMIFS(Entry!$I$4:$I$65557,Entry!$F$4:$F$65557,Main!E4,Entry!$H$4:$H$65557,Heads!$B$5)"
    .Range("M4:M4203").Formula = "=SUMIFS(Entry!$J$4:$J$65557,Entry!$F$4:$F$65557,Main!E4,Entry!$H$4:$H$65557,Heads!$B$5)"
    
    .Range("O4:O4203").Formula = "=SUMIFS(Entry!$I$4:$I$65557,Entry!$F$4:$F$65557,Main!E4,Entry!$H$4:$H$65557,Heads!$B$6)"
    .Range("P4:P4203").Formula = "=SUMIFS(Entry!$J$4:$J$65557,Entry!$F$4:$F$65557,Main!E4,Entry!$H$4:$H$65557,Heads!$B$6)"
    
    .Range("I4:P4203").Calculate
    
    With .Range("I4:P4203")
        .Value = .Value
    End With
End With
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

End Sub
 
Upvote 0

Forum statistics

Threads
1,216,101
Messages
6,128,841
Members
449,471
Latest member
lachbee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top