A faster way to process to multiple sheets/cells

CookieMonster76

Board Regular
Joined
Apr 30, 2015
Messages
201
Hi

I have the following (extract for illustration):
For Each ws In Sheets(Array("Sheet2", "Sheet2")

With ws.Range("C12")
.FormulaR1C1 = "=-ROUND(SUMIFS('TB actual'!C4,'TB actual'!C3,RC[4],'TB actual'!C[-2],R3C2)
+ SUMIFS('TB actual'!C4,'TB actual'!C3,RC[5],'TB actual'!C[-2],R3C2)
+ SUMIFS('TB a ctual'!C4,'TB actual'!C3,RC[6],'TB actual'!C[-2],R3C2)
+ SUMIFS('TB actual'!C4,'TB actual'!C3,RC[7],'TB actual'!C[-2],R3C2)
+SUMIFS('TB actual'!C4,'TB actual'!C3,RC[8],'TB actual'!C[-2],R3C2)
+SUMIFS('TB actual'!C4,'TB actual'!C3,RC[9],'TB actual'!C[-2],R3C2),0)"
.Value2 = .Value2
End With

With ws.Range("C13")
.FormulaR1C1 = "=-ROUND(SUMIFS('TB actual'!C4,'TB actual'!C3,RC[4],'TB actual'!C[-2],R3C2)
+ SUMIFS('TB actual'!C4,'TB actual'!C3,RC[5],'TB actual'!C[-2],R3C2)
+ SUMIFS('TB a ctual'!C4,'TB actual'!C3,RC[6],'TB actual'!C[-2],R3C2)
+ SUMIFS('TB actual'!C4,'TB actual'!C3,RC[7],'TB actual'!C[-2],R3C2)
+SUMIFS('TB actual'!C4,'TB actual'!C3,RC[8],'TB actual'!C[-2],R3C2)
+SUMIFS('TB actual'!C4,'TB actual'!C3,RC[9],'TB actual'!C[-2],R3C2),0)"
.Value2 = .Value2
End With

Next ws


It posts to 157 cells on over 200 sheets, but with exactly the same code in each one. It is currently taking 8 minutes to run.

I have screen updating and calculation turned off.

Is it simply the volume of transaction or is there a way to speed it up?

Thanks

Paul
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi. Paul

I'll assume there is no event code being triggered.
It looks like an inefficient formula. If so, try another approach. Can only guess as have no information - with 200 worksheets maybe an alternative set up is possible - more like a database.

regards
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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