Hello all
This code creates a pivot table and work well but instead on adding to a new worksheet how can I change it to always populate a worksheet called £Test" please
Sub CreatePivot()
Application.DisplayAlerts = False
Dim objTable As PivotTable, objField As PivotField
ActiveWorkbook.Sheets("OSDD").Select
Range("A1").Select
Set objTable = Sheets("OSDD").PivotTableWizard
Set objField = objTable.PivotFields("Station")
objField.Orientation = xlRowField
Set objField = objTable.PivotFields("Month")
objField.Orientation = xlColumnField
Set objField = objTable.PivotFields("OSDD No")
objField.Orientation = xlDataField
objField.Function = xlCount
objField.NumberFormat = " #,##0"
Application.DisplayAlerts = True
End Sub
This code creates a pivot table and work well but instead on adding to a new worksheet how can I change it to always populate a worksheet called £Test" please
Sub CreatePivot()
Application.DisplayAlerts = False
Dim objTable As PivotTable, objField As PivotField
ActiveWorkbook.Sheets("OSDD").Select
Range("A1").Select
Set objTable = Sheets("OSDD").PivotTableWizard
Set objField = objTable.PivotFields("Station")
objField.Orientation = xlRowField
Set objField = objTable.PivotFields("Month")
objField.Orientation = xlColumnField
Set objField = objTable.PivotFields("OSDD No")
objField.Orientation = xlDataField
objField.Function = xlCount
objField.NumberFormat = " #,##0"
Application.DisplayAlerts = True
End Sub