URGENT FOR MAC: Remove pivot table data fields in Excel for Mac 2011

RiaM

Board Regular
Joined
Jun 5, 2009
Messages
67
Hi guys

Sorry for using the word urgent. But I have limited time with a borrowed machine and really need to solve this issue asap.

I've written an procedure to automatically remove all existing data fields in a pivot table. The code works perfectly on a Windows PC but not on a Mac. Can you tell me what to do automatically remove data fields on a Mac?

The problem I'm having on a Mac is that Excel shuts down when attempting to execute the IsCalculated related lines. I"m using Excel for Mac 2011. Ver 14.1.0

The following is the code I'm using:

Sub RemoveOutput()
' Removes currenly viewed output fields


Dim pf As PivotField, PT As PivotTable
Dim strOldName, strOldCalc

Set PT = ActiveSheet.PivotTables(1)
PT.ManualUpdate = True
For Each pf In PT.DataFields
strOldName = pf.SourceName
With PT.PivotFields(strOldName)
If .IsCalculated Then
strOldCalc = .StandardFormula
.Delete
PT.CalculatedFields.Add strOldName, strOldCalc
Else
pf.Orientation = xlHidden
End If
End With
Next pf
PT.ManualUpdate = False

End Sub
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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