Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42220

VB.net 2008 and excel pivot tables....

$
0
0
I am trying to add additional cols of data to a pivottable. If I record a macro, I get the following line of code.

Code:

.PivotTables("LYpd1").AddDataField(.PivotTables("LYpd1").PivotFields("Avg Last year"), "Avg Last Year", .xlSum)
Adding this line in to a WITH statement results in a missing member error
Code:

With ObjXLBook.Sheets("LYpd").PivotTables(1)
.PivotTables("LYpd1").AddDataField(.PivotTables("LYpd1").PivotFields("Avg Last year"), "Avg Last Year", .xlSum)
end with

What is the correctly formatted line to add the extra column of data?

Viewing all articles
Browse latest Browse all 42220

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>