Hello,

I'm trying to create a pivot table off of a data set that dynamically changes so want to use the CurrentRegion as the SourceData. The data is on sheet "Data". The data will always starts on A1.

This is the code I have but it is not working. I keep getting the 'Type Mismatch' error message.

Sheets.Add.Name = "Pivot"

ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Sheets("Data").Range("A1").CurrentRegion).CreatePivotTable _
TableDestination:=Sheets("Pivot").Range("A3"), TableName:="PivotTable1", DefaultVersion:=xlPivotTableVersion14
[/PHP]

Does anyone know what is wrong and how it can be fixed?

Thank you!