I'm getting a macro error when i run the following macro. I'm getting a "Run Time '13': Type mismatch" error on the last line of code (Set PivoTable code....).
I've run this code frequently for the last few months and have made no changes to the code. Anyone know in detail what the type mismatch error indicates.
I've added more rows to the data that the pivot table sources from, but since I can create the pivot manually I think that's not the issue.
Thanks,
Ryan
I've run this code frequently for the last few months and have made no changes to the code. Anyone know in detail what the type mismatch error indicates.
I've added more rows to the data that the pivot table sources from, but since I can create the pivot manually I think that's not the issue.
Thanks,
Ryan
Code:
Private Sub RollupData()
'
' Go through each row in ET worksheet
' If there are multiple ET codes for the same project, FACTDesc, and month
' Summarize the data into one row
'
' This will be done by creating a new ws as a pivot table
'
'
Dim PivotTbl As PivotTable
Dim destws As Worksheet
Dim DestRng As Range
ActiveWorkbook.Sheets("ETPivotTbl").Columns("A:T").Delete Shift:=xlToLeft
Set DestRng = ActiveWorkbook.Sheets("ETPivotTbl").Cells(1, 1)
'
' Delete existing pivot table
'
Set PivotTbl = ActiveWorkbook.PivotCaches.Create(xlDatabase, ETws.Cells(1, 1).CurrentRegion, _
xlPivotTableVersion12).CreatePivotTable(DestRng, "aaa", True, xlPivotTableVersion12)