J
Jen
Hi There,
I have borrowed this code for 99,99% from Debra's excellent
PivotPower.xla ...
I just modified it a little to suit my purposes .. which it does not
do
I would like to prevent that the Data-field gets de-placed / removed
from the PT.
Is this feasible?
Sub RestrictDataFieldFeatures()
Dim pf As PivotField
Dim pt As PivotTable
Dim ws As Worksheet
On Error GoTo errHandler
Set ws = ActiveSheet
Application.ScreenUpdating = False
If PivotCheck(ws) Then
If Val(Application.Version) < 10 Then
MsgBox "Some features are only available for Excel 2002 and later
versions"
End If
On Error Resume Next
For Each pt In ActiveSheet.PivotTables
With pt
.EnableWizard = False
.EnableDrilldown = False
.EnableFieldList = False
.EnableFieldDialog = False
.PivotCache.EnableRefresh = False
For Each pf In .DataPivotField '.PivotFields
If pf.Name = "Data" Then '<>"Data" Then
With pf
.DragToPage = False
.DragToRow = False
.DragToColumn = False
.DragToData = False
.DragToHide = False
End With
End If
Next pf
End With
Next pt
Else
MsgBox "There are no pivot tables on the active sheet"
End If
exitHandler:
Set pf = Nothing
Set pt = Nothing
Set ws = Nothing
Application.ScreenUpdating = True
Exit Sub
errHandler:
GoTo exitHandler
End Sub
Thanks for your assistance!!!
SG
I have borrowed this code for 99,99% from Debra's excellent
PivotPower.xla ...
I just modified it a little to suit my purposes .. which it does not
do
I would like to prevent that the Data-field gets de-placed / removed
from the PT.
Is this feasible?
Sub RestrictDataFieldFeatures()
Dim pf As PivotField
Dim pt As PivotTable
Dim ws As Worksheet
On Error GoTo errHandler
Set ws = ActiveSheet
Application.ScreenUpdating = False
If PivotCheck(ws) Then
If Val(Application.Version) < 10 Then
MsgBox "Some features are only available for Excel 2002 and later
versions"
End If
On Error Resume Next
For Each pt In ActiveSheet.PivotTables
With pt
.EnableWizard = False
.EnableDrilldown = False
.EnableFieldList = False
.EnableFieldDialog = False
.PivotCache.EnableRefresh = False
For Each pf In .DataPivotField '.PivotFields
If pf.Name = "Data" Then '<>"Data" Then
With pf
.DragToPage = False
.DragToRow = False
.DragToColumn = False
.DragToData = False
.DragToHide = False
End With
End If
Next pf
End With
Next pt
Else
MsgBox "There are no pivot tables on the active sheet"
End If
exitHandler:
Set pf = Nothing
Set pt = Nothing
Set ws = Nothing
Application.ScreenUpdating = True
Exit Sub
errHandler:
GoTo exitHandler
End Sub
Thanks for your assistance!!!
SG