Hello,
Boy I didn't expect pivot tables to be an issue, but here I am
I got the pivot table to put the fields and calcs where I want them, actually this is almost the powerprogramming example pretty much
Sub CreatePivotTable()
Dim PTCache As PivotCache
Dim PT As PivotTable
Set PTCache = ActiveWorkbook.PivotCaches.Create( _
SourceType:=xlDatabase, _
SourceData:=Range("A1").CurrentRegion)
Worksheets.Add
Set PT = ActiveSheet.PivotTables.Add( _
PivotCache:=PTCache, _
TableDestination:=Range("A3"))
With PT
.PivotFields("Email").Orientation = xlPageField
.PivotFields("Job Category Code").Orientation = xlRowField
.PivotFields("Career Level").Orientation = xlRowField
.PivotFields("Salary").Orientation = xlDataField
.Pivotfields("Salary").Function = xlaverage
.Pivotfields("Salary").Function = xlmedian
.DisplayFieldCaptions = False
End With
End Sub
Could not for the life of my figure out how to get salary to only display average and median, I know it's a function but did not know how to implement
Also out of curiousity two questions.
1. Can I just go back to the add worksheet spot and create another pivot table in the same macro that way? (Meaning copying the code over from that spot, i'll differentiate by adding filters)
2. Anyone have a great resource that will explain how to do filters on the page field that is fairly idiot proof?
Thank you so much.
Boy I didn't expect pivot tables to be an issue, but here I am
I got the pivot table to put the fields and calcs where I want them, actually this is almost the powerprogramming example pretty much
Sub CreatePivotTable()
Dim PTCache As PivotCache
Dim PT As PivotTable
Set PTCache = ActiveWorkbook.PivotCaches.Create( _
SourceType:=xlDatabase, _
SourceData:=Range("A1").CurrentRegion)
Worksheets.Add
Set PT = ActiveSheet.PivotTables.Add( _
PivotCache:=PTCache, _
TableDestination:=Range("A3"))
With PT
.PivotFields("Email").Orientation = xlPageField
.PivotFields("Job Category Code").Orientation = xlRowField
.PivotFields("Career Level").Orientation = xlRowField
.PivotFields("Salary").Orientation = xlDataField
.Pivotfields("Salary").Function = xlaverage
.Pivotfields("Salary").Function = xlmedian
.DisplayFieldCaptions = False
End With
End Sub
Could not for the life of my figure out how to get salary to only display average and median, I know it's a function but did not know how to implement
Also out of curiousity two questions.
1. Can I just go back to the add worksheet spot and create another pivot table in the same macro that way? (Meaning copying the code over from that spot, i'll differentiate by adding filters)
2. Anyone have a great resource that will explain how to do filters on the page field that is fairly idiot proof?
Thank you so much.