Hello,

I am getting the following error when running a macro to produce a pivot table:

Run-time error '440':
Method 'Add' of 'PivotCaches' failed

Does anybody know what the reason might be? Is it a memory problem?

Thanks
Rich

Code:

FinalRow = WSD.Cells(Rows.Count, 1).End(xlUp).Row
FinalCol = WSD.Cells(1, Columns.Count).End(xlToLeft).Column
Set PRange = WSD.Cells(1, 1).Resize(FinalRow, FinalCol)
Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, _
SourceData:=PRange)