Wilder1626
asked on
Remove empty result from pivot table
Hello all.
I would like to fix this macro when creating my pivot table.
I want to remove the empty result.
Is that possible?
Thanks again for your help.
I would like to fix this macro when creating my pivot table.
I want to remove the empty result.
Is that possible?
Thanks again for your help.
If Application.Worksheets("Fake Carrier").PivotTables.Count > 0 Then Exit Sub
ThisWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"=TableDetail", Version:=xlPivotTableVersion12).CreatePivotTable _
TableDestination:="'Fake Carrier'!R4C1", TableName:="Tableau croisé dynamique2", _
DefaultVersion:=xlPivotTableVersion12
With Application.Worksheets("Fake Carrier").PivotTables("Tableau croisé dynamique2")
With .PivotFields("TO_LOC_ID")
.Orientation = xlRowField
.Position = 1
End With
With .PivotFields("USER_ID")
.Orientation = xlRowField
.Position = 2
End With
With .PivotFields("CARRIER_ID")
.Orientation = xlColumnField
.Position = 1
End With
.AddDataField .PivotFields("ID"), "Count of ID", xlCount
.TableStyle2 = "PivotStyleMedium8"
.RowAxisLayout xlTabularRow
End With
Sheets("Fake Carrier").Select
Sheets("Fake Carrier").Columns("A:A").ColumnWidth = 30
Sheets("Fake Carrier").Columns("b:b").ColumnWidth = 20
Sheets("Fake Carrier").Columns("c:c").ColumnWidth = 20
Sheets("Fake Carrier").Columns("d:d").ColumnWidth = 20
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect
Thanks for your help
Thanks for your help
Open in new window
In this example I am running up the table form the bottom, to not upset my row count when delteting lines