Microsoft Office Tutorials and References
In Depth Information
Creating Multiple Pivot Tables
Creating Multiple Pivot Tables
The final example creates a series of pivot tables that summarize data collected in a customer
survey. That data is stored in a worksheet database (see Figure 17-6) and consists of 150 rows.
Each row contains the respondent’s sex plus a numerical rating using a 1–5 scale for each of the
14 survey items.
This workbook, named survey data pivot tables.xlsm , is available on the
companion CD-ROM.
Figure 17-6: Creating a series of pivot tables will summarize this survey data.
Figure 17-7 shows a few of the 28 pivot tables produced by the macro. Each survey item is
summarized in two pivot tables (one showing percentages, and one showing the actual frequencies).
The VBA code that created the pivot tables follows:
Sub MakePivotTables()
‘ This procedure creates 28 pivot tables
Dim PTCache As PivotCache
Dim PT As PivotTable
Dim SummarySheet As Worksheet
Dim ItemName As String
 
Search JabSto ::




Custom Search