Greetings,
I am currently experiencing the following error: Run-time error '1004': Unable to get the PivotFields property of the PivotTable class on this line of code: With ActiveSheet.PivotTables("PivotTable2").PivotFields("Count of Project")
I can change "Count of Project" to "Project" and i get a different error: Run-time error '1004': Unable to set the Position property of the PivotField class with .Position = 2 highlighted.
I am trying to run 3 different pivot tables within 1 new sheet. The first table populates without any issue, but the second table only populates the first "Projects" column and not the "Count of Projects"
Thanks for the help!
I am currently experiencing the following error: Run-time error '1004': Unable to get the PivotFields property of the PivotTable class on this line of code: With ActiveSheet.PivotTables("PivotTable2").PivotFields("Count of Project")
I can change "Count of Project" to "Project" and i get a different error: Run-time error '1004': Unable to set the Position property of the PivotField class with .Position = 2 highlighted.
I am trying to run 3 different pivot tables within 1 new sheet. The first table populates without any issue, but the second table only populates the first "Projects" column and not the "Count of Projects"
Thanks for the help!
Code:
Rows("1:3").Select Selection.Delete Shift:=xlUp
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
DataSheet = ActiveSheet.Name
Sheets.Add
NewSheet = ActiveSheet.Name
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
DataSheet & "!R1C1:R" & FinalRow & "C14", Version:=xlPivotTableVersion14). _
CreatePivotTable TableDestination:=NewSheet & "!R3C1", TableName:="PivotTable1" _
, DefaultVersion:=xlPivotTableVersion14
Sheets(NewSheet).Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Assignee")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Key")
.Orientation = xlRowField
.Position = 2
End With
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("Key"), "Count of Key", xlCount
ActiveCell.Offset(0, 3).Range("A1").Select
Sheets(NewSheet).Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
DataSheet & "!R1C1:R" & FinalRow & "C14", Version:=xlPivotTableVersion14). _
CreatePivotTable TableDestination:=NewSheet & "!R3C4", TableName:="PivotTable2" _
, DefaultVersion:=xlPivotTableVersion14
Sheets(NewSheet).Select
Cells(3, 4).Select
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Project")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Count of Project")
.Orientation = xlRowField
.Position = 2
End With
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable2").PivotFields("Project"), "Count of Project", xlCount
ActiveCell.Offset(0, 5).Range("A1").Select
Sheets(NewSheet).Select
ActiveWorkbook.Worksheets(NewSheet).PivotTables("PivotTable2").PivotCache. _
CreatePivotTable TableDestination:=NewSheet & "!R3C7", TableName:="PivotTable3" _
, DefaultVersion:=xlPivotTableVersion14
Sheets(NewSheet).Select
Cells(3, 7).Select
With ActiveSheet.PivotTables("PivotTable3").PivotFields("Priority")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable4").PivotFields("Key")
.Orientation = xlRowField
.Position = 2
End With
ActiveSheet.PivotTables("PivotTable3").AddDataField ActiveSheet.PivotTables( _
"PivotTable3").PivotFields("Key"), "Count of Key", xlCount
ActiveWindow.SmallScroll Down:=-12
ActiveCell.Offset(-1, -6).Range("A1").Select
ActiveCell.FormulaR1C1 = "Overdue JIRAs By Employee"
ActiveCell.Offset(0, 3).Range("A1").Select
ActiveCell.FormulaR1C1 = "Overdue JIRAs by Client"
ActiveCell.Offset(0, 3).Range("A1").Select
ActiveCell.FormulaR1C1 = "Overdue JIRAs by Priority"
ActiveCell.Offset(0, -6).Range("A1").Select
Selection.Font.Bold = True
ActiveCell.Offset(0, 3).Range("A1").Select
Selection.Font.Bold = True
ActiveCell.Offset(0, 3).Range("A1").Select
Selection.Font.Bold = True
ActiveCell.Offset(9, 5).Range("A1").Select
ActiveWindow.SmallScroll Down:=-36
ActiveCell.Offset(-9, -11).Range("A1").Select
Selection.Font.Size = 12
ActiveCell.Offset(0, 3).Range("A1").Select
Selection.Font.Size = 12
ActiveCell.Offset(0, 3).Range("A1").Select
Selection.Font.Size = 12
End Sub