Hi,
I'm creating the Macro for a pivot table.
There are a couple of errors that tstop it running, I've checked it and can't see why it is, can anyone shed some light on what needs changing the macro is:
GiftPivot Macro
'
'
Columns("A:A").Select
Selection.NumberFormat = "0"
Columns("A:Q").Select
Sheets.Add
ActiveWorkbook.Worksheets("Sheet1").PivotTables("PivotTable6").PivotCache. _
CreatePivotTable TableDestination:="Sheet3!R3C1", TableName:="PivotTable7" _
, DefaultVersion:=xlPivotTableVersion12
Sheets("Sheet3").Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("PivotTable7").PivotFields( _
"CAMPAIGN_RESPONDED_TO " _
)
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable7").PivotFields( _
"CAMPAIGN_NUMBER_RESPONDED_TO " _
)
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable7").PivotFields( _
"CAMPAIGN_YEAR_OF_JOINING " _
)
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable7").PivotFields( _
"CAN_MAIL " _
)
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable7").PivotFields( _
"CAN_PHONE " _
)
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable7").PivotFields("PAYMENT RANKING")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable7").PivotFields( _
"NUMBER OF MONTHS SINCE PAYMENT")
.Orientation = xlColumnField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable7").AddDataField ActiveSheet.PivotTables( _
"PivotTable7").PivotFields( _
"NAME_KEY " _
), _
"Count of NAME_KEY " _
, xlCount
End Sub
I'm creating the Macro for a pivot table.
There are a couple of errors that tstop it running, I've checked it and can't see why it is, can anyone shed some light on what needs changing the macro is:
GiftPivot Macro
'
'
Columns("A:A").Select
Selection.NumberFormat = "0"
Columns("A:Q").Select
Sheets.Add
ActiveWorkbook.Worksheets("Sheet1").PivotTables("PivotTable6").PivotCache. _
CreatePivotTable TableDestination:="Sheet3!R3C1", TableName:="PivotTable7" _
, DefaultVersion:=xlPivotTableVersion12
Sheets("Sheet3").Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("PivotTable7").PivotFields( _
"CAMPAIGN_RESPONDED_TO " _
)
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable7").PivotFields( _
"CAMPAIGN_NUMBER_RESPONDED_TO " _
)
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable7").PivotFields( _
"CAMPAIGN_YEAR_OF_JOINING " _
)
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable7").PivotFields( _
"CAN_MAIL " _
)
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable7").PivotFields( _
"CAN_PHONE " _
)
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable7").PivotFields("PAYMENT RANKING")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable7").PivotFields( _
"NUMBER OF MONTHS SINCE PAYMENT")
.Orientation = xlColumnField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable7").AddDataField ActiveSheet.PivotTables( _
"PivotTable7").PivotFields( _
"NAME_KEY " _
), _
"Count of NAME_KEY " _
, xlCount
End Sub