Article ID: 183611
Article Last Modified on 6/17/2005
Microsoft Office 98:Office:Startup:Excel
A1: Name B1: Amount C1: Area
A2: Bob B2: 1 C2: e
A3: Sue B3: 1 C3: w
A4: Sue B4: 1 C4: e
A5: Bob B5: 1 C5: n
A6: Tom B6: 1 C6: e
A7: Sue B7: 1 C7: n
A8: Tom B8: 1 C8: n
A9: Bob B9: 1 C9: w
Sub Show_Pages()
Dim mysheet As String
' Reduce the amount of screen flickering.
Application.ScreenUpdating = False
' Set the name of the worksheet with the PivotTable.
mysheet = ActiveSheet.Name
With Sheets(mysheet).PivotTables(1)
' Loop through all items in the "Area" page field.
For Each x In .PageFields("Area").PivotItems
.PivotFields("Area").CurrentPage = x.Name
' Insert a new worksheet using Sheet in the Startup
' folder.
Sheets.Add Type:="Worksheet"
ActiveSheet.Name = x.Name
' Activate the worksheet that contains the PivotTable.
Sheets(mysheet).Select
' Select the PivotTable and copy it.
.PivotSelect "", xlDataAndLabel
Selection.Copy
' Activate the worksheet with the name from the item
' in the page field and paste the PivotTable with this
' page field item displayed.
Sheets(x.Name).Select
ActiveSheet.Paste
Next
End With
End Sub
page fields
Additional query words: XL98
Keywords: kbbug kbnofix kbprogramming kbcode KB183611