I'm trying to put a macro together that will make a simple pivot table using the data from an active worksheet. When I try to run it, I receive a type mismatch error. When I start the debugger, the first section is highlighted: ActiveWorkbook.PivotCaches through xlPivotTableVersion10. Initially, the TableDestination was blank and I thought that might be the problem, but after adding a destination I still get the same error.
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, _ SourceData:=ActiveSheet.UsedRange).CreatePivotTable TableDestination:="Sheet1!R3C1", _ TableName:="PivotTable1", DefaultVersion:=xlPivotTableVersion10 ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(1, 1) With ActiveSheet.PivotTables("PivotTable1").PivotFields("Program Name") .Orientation = xlColumnField .Position = 1 End With ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _ "PivotTable1").PivotFields("Dollars Awarded"), "Sum of Dollars Awarded", xlSum With ActiveSheet.PivotTables("PivotTable1").PivotFields("Dept Head") .Orientation = xlRowField .Position = 1 End With