Pivot table memory error

A

Ashish

I have used following code to generate pivot table
in a worksheet:
sub foo()
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase,
SourceData:= _
"'[data.xls]ConsolidatedData'!R1C1" & ":R" & rowcount
& "C" & idcol).CreatePivotTable TableDestination:=tabdes, _
TableName:="PivotTable1"
end sub
This function is called on a hyperlink click.
When I call the function for the 4th/5th time, I get
a memory reference error & excel shuts down. It seems
the memory is not released. Is there a way to clear up
the referred memory ? Or an alternative piece of code
that serves the same purpose.

Thanks in Advance,
Ashish
 

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