Name

pivottable.MergeLabels [= setting]

Synopsis

True merges the pivot table’s outer row item, column items, subtotal, and grand total labels with their rows or columns; False uses unmerged cells for the labels. Default is False. Use the following code to see the effect of merged versus unmerged labels:

Sub ToggleMergedLabels(  )
    Dim pt As PivotTable
    ' Active worksheet must contain a pivot table.
    Set pt = ActiveSheet.PivotTables(1)
    ' Switch merged labels on/off.
     pt.MergeLabels = Not pt.MergeLabels
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.