Hi Friends,
While setting up the vba code for the above, I am not able to move forward for putting out the below condition in the existing code.
Attached the latest sheet for your reference
Sub SetupPivot()
Application.ScreenUpdating = False
Dim pt As PivotTable
Dim WSD As Worksheet
Set WSD = Worksheets("Base Sheet")
Dim PTOutput As Worksheet
Set PTOutput = Worksheets("im volume summary")
Dim PTCache As PivotCache
Dim PRange As Range
'Clean up any pivot tables on the PIVOT page
For Each pt In PTOutput.PivotTables
pt.TableRange2.Clear
Next pt
' Find the last row with data
Dim finalRow As Long
finalRow = WSD.Cells(Application.Rows.Count, 1).End(xlUp).Row
' Find the last column with data
Dim finalCol As Long
finalCol = WSD.Cells(1, Application.Columns.Count).End(xlToLeft).Column
' Find the range of the data
Set PRange = WSD.Cells(1, 1).Resize(finalRow, finalCol)
Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=PRange)
' Create the pivot table
Set pt = PTCache.CreatePivotTable(TableDestination:=PTOutput.Cells(1, 1), _
TableName:="im volume summary")
' Define the layout of the pivot table
' Set update to manual to avoid recomputation while laying out
pt.ManualUpdate = True
With pt
.PivotFields("Priority").Orientation = xlColumnField
.PivotFields("Incident ID").Orientation = xlDataField
.PivotFields("Status").Orientation = xlPageField
.PivotFields("Description").Orientation = xlPageField
.PivotFields("Field Trials?").Orientation = xlPageField
.PivotFields("Reported Date").Orientation = xlRowField
End With
Application.ScreenUpdating = True
End Sub