How to get the VBA to calculate in loops or run more efficiently

Keewi82

New Member
Joined
Jun 29, 2016
Messages
9
Hi All

I have a really large range that requires mapping and recalculation and is taking a long time to recalc, any suggestions and ideas on how to make this more efficient? was thinking a loop or defining integers but i am really unfamiliar with this function. mapping is on 20457 rows and 34 columns and it uses index match as the primary formula that looks over 2 other data sets the largest being 306000 rows and about 40 columns

Currently macro is:

Sub UpdateCourseDetailed()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Range("P16:AW16").AutoFill Destination:=Range("P16:AW" & Cells(Rows.Count, "C").End(xlUp).Row)
Call FastRecalcSheets(True)
'Output.ResetFiltering
Range("P17:AW" & Cells(Rows.Count, "C").End(xlUp).Row).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

Call Fast Relcalc part

Sub FastRecalcSheets(Optional SilentMode As Boolean = False)
CRSEDETAILEDDATA.Calculate

If Not SilentMode Then
MsgBox "Recalculation complete."
End If
End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
This should speed things up, unless my addled brain tricks me:

Code:
Range("P17:AW" & Cells(Rows.Count, "C").End(xlUp).Row).Copy
Range("P17:AW" & Cells(Rows.Count, "C").End(xlUp).Row).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
 
Upvote 0
Thanks RedBeard
it has made the last step more efficient but unfortunately the calculation is stage is still really laggy
 
Upvote 0
Well, considering how much data you have (and I assume quite a few formulas), I can't think of a way to make that bit go any faster.

Someone smarter here might know of a way though.
 
Upvote 0
No props to you for helping in the first place!
Yeah hopefully someone can help me try and perform the calculations in groups of 500 or something along those lines
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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