Analyze_This
Board Regular
- Joined
- Oct 29, 2008
- Messages
- 122
Looked all over the web and I can't find how to create a pivot table in excel. Lots of posts about it...none of them work. Here's the code that I have. I recorded it and just replaced the SourceData range with current region argument. Can anyone tell me why I keep getting a "Type Mismatch" error on this?
Code:
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
ActiveSheet.Range("A1").CurrentRegion, Version:=xlPivotTableVersion12).CreatePivotTable _
TableDestination:="", TableName:="PivotTable", DefaultVersion _
:=xlPivotTableVersion12