Hi All - I am trying to record a code wherein I am inserting a blank ine after each item in my pivot table. I was able to generate below code, question is, is there a way to shorten this code?
Code:
Sub Macro1()
'
' Macro1 Macro
'
'
ActiveSheet.PivotTables("PivotTable1").PivotSelect "'Function Name'[All]", _
xlLabelOnly + xlFirstRow, True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Cost Center"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Cost Element"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Cost element name"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Ttl Fx+Vbl value CAC"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("CO area currency"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Ttl Fxd/Vbl value OC"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Object Currency"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Created on"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Entered by"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Total val. rep.crcy"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Report currency"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Document Header Text"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Document Number"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("$ MM").LayoutBlankLine = _
True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Function Name"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Report Function"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Budget Upload Contact"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"Blocked/Unblocked/To be blocked").LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Business").LayoutBlankLine _
= True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Sub Region"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Major Org"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("B Org").LayoutBlankLine = _
True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Global Region"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Organization"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Market/Function"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("GBU").LayoutBlankLine = _
True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Sub-function"). _
LayoutBlankLine = True
ActiveSheet.PivotTables("PivotTable1").PivotFields("Region").LayoutBlankLine = _
True
Range("B6").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Sub Region").PivotItems( _
"APAC PGP").ShowDetail = False
Range("B8").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Sub Region").PivotItems( _
"EUROPE PGP").ShowDetail = False
Range("B10").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Sub Region").PivotItems( _
"GLBL PGP").ShowDetail = False
Range("B12").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Sub Region").PivotItems( _
"NA PGP").ShowDetail = False
End Sub