Hi Everyone,
I am working with the code below but am getting an "Invaild procedure call or argument" error on the code in red.
I have tried everything I know with no luck. Can anyone help?????
Thanks
Allen
Sub ErrorReportingCreatePivotTableTake1()
'
' ErrorReportingCreatePivotTableTake1 Macro
'
'
Dim WSD As Worksheet
Dim PTCache As PivotCache
Dim PT As PivotTable
Dim PRange As Range
Dim FinalRow As Long
Set WSD = Worksheets("Error_Reporting")
' Define input area and set up a Pivot Cache
FinalRow = WSD.Cells(Application.Rows.Count, 1).End(xlUp).Row
FinalCol = WSD.Cells(1, Application.Columns.Count). _
End(xlToLeft).Column
Set PRange = WSD.Cells(1, 1).Resize(FinalRow, FinalCol)
Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:= _
xlDatabase, SourceData:=PRange.Address)
' Create the Pivot Table from the Pivot Cache
Sheets.Add
Set PT = PTCache.CreatePivotTable(TableDestination:="Sheet10!R3C1", TableName:="PivotTable3", _
DefaultVersion:=xlPivotTableVersion14)
End Sub
I am working with the code below but am getting an "Invaild procedure call or argument" error on the code in red.
I have tried everything I know with no luck. Can anyone help?????
Thanks
Allen
Sub ErrorReportingCreatePivotTableTake1()
'
' ErrorReportingCreatePivotTableTake1 Macro
'
'
Dim WSD As Worksheet
Dim PTCache As PivotCache
Dim PT As PivotTable
Dim PRange As Range
Dim FinalRow As Long
Set WSD = Worksheets("Error_Reporting")
' Define input area and set up a Pivot Cache
FinalRow = WSD.Cells(Application.Rows.Count, 1).End(xlUp).Row
FinalCol = WSD.Cells(1, Application.Columns.Count). _
End(xlToLeft).Column
Set PRange = WSD.Cells(1, 1).Resize(FinalRow, FinalCol)
Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:= _
xlDatabase, SourceData:=PRange.Address)
' Create the Pivot Table from the Pivot Cache
Sheets.Add
Set PT = PTCache.CreatePivotTable(TableDestination:="Sheet10!R3C1", TableName:="PivotTable3", _
DefaultVersion:=xlPivotTableVersion14)
End Sub