PDA

View Full Version : [SOLVED:] Pivot Table Error with VBA Code



JOEYSCLEE
08-18-2017, 10:12 AM
Hi, There
After creating, there are NO DATA under Row Label Field in the Pivot Table. Would you please :help to review and advise the correct code?
Enclosed the attachment with VBA code for your reference.

Bob Phillips
08-18-2017, 02:27 PM
Add a line to put something in the values pane


ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("Quantity"), "Sum of Quantity", xlSum

p45cal
08-18-2017, 03:15 PM
or you might try
objTable.DisplayImmediateItems = True

JOEYSCLEE
08-18-2017, 09:41 PM
Thanks your comment!!


Add a line to put something in the values pane


ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("Quantity"), "Sum of Quantity", xlSum

JOEYSCLEE
08-18-2017, 09:46 PM
Hi, p45cal....Your advised code works perfectly:2jump:. Thanks for reviewing every time.:bow:


or you might try
objTable.DisplayImmediateItems = True

Bob Phillips
08-19-2017, 01:17 AM
or you might try
objTable.DisplayImmediateItems = True


https://www.excelguru.ca/forums/showthread.php?8151-Analysing-alot-of-data-using-a-pivot-table&p=33433#post33433

Post #4