Microsoft Office 2000/Visual Basic Programmer's Guide   

Creating PivotTable Reports

The easiest way to create a PivotTable report is with the PivotTable Wizard. The wizard allows you to create a PivotTable report from data in one or more Excel ranges, an external data source, or an existing PivotTable report.

For many solutions, you may not need to create a PivotTable report in VBA — you can create a PivotTable report by using the wizard and then manipulate the data either through the Excel user interface or from VBA code. If you're using Excel as a reporting tool, however, you may find it useful to create a PivotTable report from code. The following sections describe how to create a PivotTable report from a range on an Excel worksheet, another PivotTable report, and an external data source.