The information in this article applies to:
SUMMARYIn Microsoft Excel, when you use the PivotTable command to create a table from a list, the data is always summarized according to the option that is selected in the Summarize By list of the PivotTable Field dialog box. Because this list box does not have a "no summarization" option, there is no way to use a PivotTable to tabulate the data without summarizing it in some way. This article shows how you can use Microsoft Visual Basic for Applications code to create such a table. MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty
either expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes that you
are familiar with the programming language being demonstrated and the tools used to
create and debug procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to provide added
functionality or construct procedures to meet your specific needs. If you have limited
programming experience, you may want to contact a Microsoft Certified Solution Provider
or the Microsoft fee-based consulting line at (800) 936-5200. For more information about
Microsoft Certified Solution Providers, please see the following page on the World Wide Web:
http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.aspAs an example, suppose a company makes four products, each of which comes in three sizes. To use the sample code provided below, create a Microsoft Excel worksheet containing the following information:
Suppose you want to create a table that lists the customers for each
product in each size. Because a PivotTable always summarizes in some
manner (that is, by using the Sum, Count, Average, or other function), there is no way you can use the PivotTable command to accomplish the task, short of setting up separate columns for each customer. The following code uses the column headings in row 1 and the row headings in column E to accomplish the task.
The results on the worksheet will appear as follows:
NOTE: You are still subject to the 255 characters per cell limitation. Also, the macro does not format the columns to display all of the information in each cell. You may want to use Format, Column, or Wrap Text to do this.
Additional query words:
Keywords : kbprg kbdta kbdtacode PgmHowto KbVBA |
Last Reviewed: January 6, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |