ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot Table (https://www.excelbanter.com/excel-programming/437956-pivot-table.html)

Nedan Nedzatra

Pivot Table
 
Hia!

Happy New Year Friends.

I have spent almost 3 hours not but I am not able to spot the bug;

The following codes create a Pivot Table but the table does not generate
reports except for the field headings;

Sub SalesReports()

Dim pc As PivotCache
Dim pt As PivotTable

Set pc = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=Range("b5:g39"))

Set pt = ActiveSheet.PivotTables.Add(PivotCache:=pc,
tabledestination:=Range("i5"))

Application.GoTo Range("i5")

End Sub

What is the problem in the codes?

Thanks.

Nedan Nedzatra

Pivot Table
 
Hia

Sorry for any inconvenience caused mates!

It seems if the actual data do not follow headers in the immediate cell
below programmatically generated Pivot Tables would not work. Still I do not
understand why but hope this piece of information might be userful to
starters.

Thanks.

"Nedan Nedzatra" wrote:

Hia!

Happy New Year Friends.

I have spent almost 3 hours not but I am not able to spot the bug;

The following codes create a Pivot Table but the table does not generate
reports except for the field headings;

Sub SalesReports()

Dim pc As PivotCache
Dim pt As PivotTable

Set pc = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=Range("b5:g39"))

Set pt = ActiveSheet.PivotTables.Add(PivotCache:=pc,
tabledestination:=Range("i5"))

Application.GoTo Range("i5")

End Sub

What is the problem in the codes?

Thanks.



All times are GMT +1. The time now is 10:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com