Have recorded the following macro but it is asking me to debug it & I cant understand what is going wrong.. pls help
Code:
Sheets("Pivot").Visible = True
Application.Goto Reference:="'RPA Readiness'!R1C1"
Application.Goto Reference:="Pivot!R1C1"
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"'Process Map'!R9C1:R1501C7", Version:=xlPivotTableVersion15). _
CreatePivotTable TableDestination:="[RPA_Diagnostic.xlsm]Pivot!R3C1", _
TableName:="PivotTable11", DefaultVersion:=xlPivotTableVersion15
With ActiveSheet.PivotTables("PivotTable11").PivotFields("Process L1")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable11").PivotFields("Process L2")
.Orientation = xlRowField
.Position = 2
End With
With ActiveSheet.PivotTables("PivotTable11").PivotFields("Process L3")
.Orientation = xlRowField
.Position = 3
End With
ActiveSheet.PivotTables("PivotTable11").AddDataField ActiveSheet.PivotTables( _
"PivotTable11").PivotFields("% Probablity of Automation"), _
"Count of % Probablity of Automation", xlCount
With ActiveSheet.PivotTables("PivotTable11").PivotFields( _
"Count of % Probablity of Automation")
.Caption = "Average of % Probablity of Automation"
.Function = xlAverage
End With
ActiveSheet.PivotTables("PivotTable11").PivotFields("Process L1").Subtotals = _
Array(False, False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("PivotTable11").PivotFields("Process L2").Subtotals = _
Array(False, False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("PivotTable11").PivotFields("Process L3").Subtotals = _
Array(False, False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("PivotTable11").PivotFields("Process L4").Subtotals = _
Array(False, False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("PivotTable11").PivotFields("Process L5").Subtotals = _
Array(False, False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("PivotTable11").PivotFields( _
"Diagnostic Completion Check").Subtotals = Array(False, False, False, False, False, _
False, False, False, False, False, False, False)
ActiveSheet.PivotTables("PivotTable11").PivotFields( _
"% Probablity of Automation").Subtotals = Array(False, False, False, False, False, _
False, False, False, False, False, False, False)
With ActiveSheet.PivotTables("PivotTable11")
.ColumnGrand = False
.RowGrand = False
End With
ActiveSheet.PivotTables("PivotTable11").RowAxisLayout xlTabularRow
ActiveSheet.PivotTables("PivotTable11").RepeatAllLabels xlRepeatLabels
With ActiveSheet.PivotTables("PivotTable11").PivotFields("Process L1")
.PivotItems("(blank)").Visible = False
End With
Application.Goto Reference:="Pivot!R1C1"
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.Goto Reference:="Pivot!R3C1"
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Pivot").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Pivot").Sort.SortFields.Add Key:=Range("D4:D1508"), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Pivot").Sort
.SetRange Range("A3:D1508")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Last edited: