Pivot Table created in Macro doesn't Refresh

KHaag

New Member
Joined
Jun 1, 2018
Messages
21
I've created a Pivot Table, in a Macro. It isn't doing all of the Sum calculations on creation. When I refresh the Pivot Table manually, it looks like this:
1601719494540.png



The Pivot Table created in the Macro looks like this:
1601719341297.png


My code is:
'add, organize and format Pivot Table fields
VBA Code:
    With myPivotTable
        .PivotFields("Stands::StandTextName").Orientation = xlRowField
        .PivotFields("GradingsSpecies").Orientation = xlRowField
        With .PivotFields("TPA")
            .Orientation = xlDataField
            .Position = 1
            .Function = xlSum
            .NumberFormat = "#,##0.0000000"
        End With
            With .PivotFields("BASAL AREA")
            .Orientation = xlDataField
            .Position = 2
            .Function = xlSum
            .NumberFormat = "#,##0.00"
        End With
       
        'Turn off Grand Totals
         myPivotTable.ColumnGrand = False

    End With
    '
    'Refresh myPivotTable as a precaution
    Range("B7").Select
    ActiveSheet.PivotTables("PivotTableNewSheet").PivotCache.Refresh
 
Last edited by a moderator:

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I believe I have found the answer to my question above. No longer looking for responses.
Thank you
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,780
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top