PreserveFormatting Property Example

This example preserves the formatting of the first PivotTable report on worksheet one.

Worksheets(1).PivotTables("Pivot1").PreserveFormatting = True

This example demonstrates how setting PreserveFormatting to False causes the AutoFormat to be set to xlRangeAutoFormatNone instead of the specified xlRangeAutoFormatColor1 format.

With Workbooks(1).Worksheets(1).QueryTables(1)
    .Range.AutoFormat = xlRangeAutoFormatColor1
    .PreserveFormatting = False
    .Refresh

End With