Hi, I'm trying to create a number of pivot tables - the specific tables that are created are dependant on tick boxes from a userform.

I figured the easiest way to do this (and most memory efficient) would be to set up one pivot cache, and then create the tables from this.

It should be relatively simple, but I'm struggling!

Here's my code so far...

'create pivot data
Dim CredList_SourcePivot As PivotCache
CredList_PivotSource = ActiveSheet.Name & "!R1C1:R" & LastRow & "C" & LastColumn
Set CredList_SourcePivot = ActiveWorkbook.PivotCaches.Add(xlDatabase, CredList_PivotSource)

'create pivot tables
If Creditors_Listing.CredList_Aging_Tick.Value = True Then

ActiveWorkbook.PivotCaches(CredList_SourcePivot).CreatePivotTable _
        TableDestination:="", TableName:="PivotTable2", _
        DefaultVersion:=xlPivotTableVersion10
Cheers

Charlie