For some reason this Pivot is not working. Any ideas why this would not preform the way it was recorded? It should create a sheet tab "Sheet5" everytime and it is not. There are four other sheet tabs in this file. Thanks -R-
Sub Pivot1() Columns("A:A").Select Sheets.Add ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "Open Orders!R1C1:R1048576C1", Version:=xlPivotTableVersion12). _ CreatePivotTable TableDestination:="Sheet5!R3C1", TableName:="PivotTable8" _ , DefaultVersion:=xlPivotTableVersion12 Sheets("Sheet5").Select Cells(3, 1).Select With ActiveSheet.PivotTables("PivotTable8").PivotFields("SOSOLN") .Orientation = xlRowField .Position = 1 End With ActiveSheet.PivotTables("PivotTable8").AddDataField ActiveSheet.PivotTables( _ "PivotTable8").PivotFields("SOSOLN"), "Count of SOSOLN", xlCount
If I create the workbook in sequence it does create Sheet5, even with your edit... however look at what the pivot looks like.... it does not honor the SOSOLN into the rows... as the recorder does it. Something is going on in the using of the same field as rows and values..
Please run the code and you will see what I mean. (at least is has not been working for me). PivotError.jpg
Sheets.Add
to
Sheets.Add.Name = "Sheet5"