Slow code

TorontoNewf

New Member
Joined
Nov 14, 2016
Messages
20
Greetings,

I have the following code which is REALLY

Code:
For Each pi In pt.DataPivotField.PivotItems    
      pi.Caption = Pi.Caption & " "
Next pi

How do I make this faster?
Is there something that I am missing here?

Thanks,
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Maybe oversimplifying but you could try:

Code:
Application.ScreenUpdating = False

For Each pi In pt.DataPivotField.PivotItems    
      pi.Caption = Pi.Caption & " "
Next pi

Application.ScreenUpdating = True
 
Upvote 0
I hadn't used this, as it was not really a complex macro.
Nonetheless, I tried it this morning with the suggestion, and there is no doubt - it was faster.
However, even without the ScreenUpdating, Excel itself was much faster this morning.

I did get Excel 2016 installed last week, and
my machine DID get a reboot over the weekend,
so perhaps that's all that needed to be done.
Automatic updates always seem to be monitored.

O happy day!

That being said, I do thank you for your input.

Cheers,
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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