Cannot Select Pivot Table Ranges in VBA

I want to format the data section (excluding the header row) of a Pivot Table in code.

Several websites tell me how to identify the various parts of a Pivot Table, but the code doesn't work the way they say. This is what happens when I step through the following code:

Dim pt As PivotTable Set pt = ActiveSheet.PivotTables("ptPrice")   With pt     .TableRange1.Select     ' Selects the whole PT     .TableRange2.Select     ' Select the whole PT plus the "bar" above it     .RowRange.Select        ' Same as TableRange1     .DataBodyRange.Select   ' Selects final column only     .PageRange.Select       ' Selects "bar" above the PT     .DataLabelRange.Select  ' Error 1004 "Unable to get the DataLabelRange property...     .ColumnRange.Select     ' Error 1004 "Unable to get the DataLabelRange property... End With 

Replay

Category: microsoft excel Time: 2016-07-28 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.207 (s). 12 q(s)