Dear expertise
I have vba code to create pivot from rawdata of DIS_Q1-Q4 into newsheet Amortization, i want make change on code to take dates from column I till end of column CRM Becoz the date range extend by month wise report. so starting date from column header I till CRM header.
Sub pivt()
ActiveWorkbook.Sheets("DIS_Q1-Q4").Select
r = Range("A1").End(xlDown).Row
c = Range("A1").End(xlToRight).Column
Set ws = Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, _
SourceData:="DIS_Q1-Q4!R1C1:R" & r & "C" & c).CreatePivotTable _
TableDestination:=ws.Name & "!R3C1", TableName:="PivotTable4"
ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _
"PivotTable4").PivotFields("Capitalized Commissions"), "Sum of Capitalized Commissions", xlSum
With ActiveSheet.PivotTables("PivotTable4")
.TableStyle2 = ""
.RowAxisLayout xlCompactRow
.PivotFields("Capitalized Quarter").Orientation = xlPageField
.PivotFields("CALL TYPE").Orientation = xlColumnField
.PivotFields("PUDO").Orientation = xlRowField
.PivotFields("PROD TYPE").Orientation = xlRowField
.PivotFields("Capitalized Commissions").NumberFormat = "#,##0.00_);[Red](#,##0.00)"
'Instead of Capitalized commission i want all dates include pivot fields as sum with number format till CRM column'
ActiveSheet.Name = "Amortization"
ActiveWindow.Zoom = 85
End With
With ActiveSheet.PivotTables("PivotTable4")
.InGridDropZones = True
.RowAxisLayout xlTabularRow
End With
MsgBox ("Pivot Done")
End Sub
let me know any tricks or possbile at Calcualte field options too
Please find the attachment
Bookmarks