Pivottables change datatype in vba

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

But how do change the datatype from default xlCount to xlSum using vba code?
I have trying to slot it into the With End With is that possible?

With .PivotFields("venue")
.Orientation = xlRowField
.Position = 1
End With

TIA
johnb
 
Hi John

If Venue is a Row field, then you cannot use Count or Sum. You can only
apply it to Data fields.

Maybe

With ActiveSheet.PivotTables("PivotTable1").PivotFields("Count of
Venue")
..Function = xlSum
End With

Obvioulsy change PivotTable1 to the number relevant for your sheet.
 
Cheers Roger

johnb

Roger Govier said:
Hi John

If Venue is a Row field, then you cannot use Count or Sum. You can only
apply it to Data fields.

Maybe

With ActiveSheet.PivotTables("PivotTable1").PivotFields("Count of
Venue")
..Function = xlSum
End With

Obvioulsy change PivotTable1 to the number relevant for your sheet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top