View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Transfer pivot table data to another workbook

If that pivottable is on a dedicated worksheet with nothing else, you could just
copy the cells:

dim ActWks as worksheet
dim newWks as worksheet

set actwks = worksheets("sheet1")
set newwks = worksheets.add

actwks.usedrange.copy
newwks.range("a1").pastespecial paste:=xlpastevalues

If you had to pick out one pivottable...

Dim ActWks As Worksheet
Dim newWks As Worksheet

Set ActWks = Worksheets("sheet1")
Set newWks = Worksheets.Add

ActWks.PivotTables(1).TableRange1.Copy
newWks.Range("a1").PasteSpecial Paste:=xlPasteValues

But glad you found a way for it to work.

Tony James wrote:

Dave Peterson wrote:
Copy|paste special|values (the copy won't be a pivottable anymore).

Then use one of the techniques at Debra Dalgleish's site to fill in those empty
cells:
http://contextures.com/xlDataEntry02.html


Hi

Thanks for your help on this. I recorded a macro to copy and paste the
pivot table then tried to amend it to get the data I required. I could
get some of the data but not all at the same time. It was all getting
a bit messy. In the end I found another way:

x = pt.RowRange gives an array of values in the row area (Order no. &
Activity Code)

y = pt.DataBodyRange gives an array of values in the data area (Time)

Then it was easy to iterate through the arrays copying the values to
the other workbook.

Also thanks for the link, I've used your FillColBlanks routine to fill
the blank Order numbers.


--

Dave Peterson