Pivottables in a macro

M

Michael

Hi, I need to create a pivottable in a macro on a set of
data that is not fixed (ie could be a different size each
time the macro is run)I presume that the sourcedata needs
to be amended and presume it should utilise a
currentregion formula but cannot seem to get it to work.


ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase,
SourceData:= _
"Sheet1!R8C3:R10C9").CreatePivotTable
TableDestination:="", TableName:= _
"PivotTable12",
DefaultVersion:=xlPivotTableVersion10



Any ideas?
 

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

Top