All,
I have this code that can create a pivot table for my monthly data but when I try to modify and use it for my 8 week trend data it gives me an error that I cannot do it because I am over 8000 columns. I need to group weekending into days, then I will be able to use the code for my 8 week trend. By the way I add a filter which on my data sheet any tickets closed within 8 weeks gives me the word valid at the end of the row. So I filter on that so I can get all tickets closed in 8 weeks. Unfortunately I did not at that to this code. I would need help doing that. See code below....
I have this code that can create a pivot table for my monthly data but when I try to modify and use it for my 8 week trend data it gives me an error that I cannot do it because I am over 8000 columns. I need to group weekending into days, then I will be able to use the code for my 8 week trend. By the way I add a filter which on my data sheet any tickets closed within 8 weeks gives me the word valid at the end of the row. So I filter on that so I can get all tickets closed in 8 weeks. Unfortunately I did not at that to this code. I would need help doing that. See code below....
Code:
Sub CreatePivot()
' Creates a PivotTable report from the table on Sheet1
' by using the PivotTableWizard method with the PivotFields
' method to specify the fields in the PivotTable.
Dim objTable As PivotTable, objField As PivotField
' Select the sheet and first cell of the table that contains the data.
ActiveWorkbook.Sheets("Closed Data").Select
Range("A1").Select
' Create the PivotTable object based on the Closed data on Sheet1.
Set objTable = Sheet1.PivotTableWizard
' Specify row and column fields.
Set objField = objTable.PivotFields("Assigned To")
objField.Orientation = xlRowField
Set objField = objTable.PivotFields("Weekending")
objField.Orientation = xlColumnField
' Specify a data field with its summary
' function and format.
Set objField = objTable.PivotFields("Number")
objField.Orientation = xlDataField
'objField.Function = xlSum
'objField.NumberFormat = "$ #,##0"
' Specify a page field.
'Set objField = objTable.PivotFields("GENDER")
'objField.Orientation = xlPageField
' Preview the new PivotTable report.
'ActiveSheet.PrintPreview
' Prompt the user whether to delete the PivotTable.
'Application.DisplayAlerts = False
'If MsgBox("Delete the PivotTable?", vbYesNo) = vbYes Then
' ActiveSheet.Delete
'End If
'Application.DisplayAlerts = True
End Sub