View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] Mr_Tony_James@hotmail.co.uk is offline
external usenet poster
 
Posts: 1
Default Transfer pivot table data to another workbook

Hi

I'm trying to transfer data from a pivot table in the following format:

Order Number Activity Code Time
400500 Z1 0:30
400600 X1 0:15
P3 0:15
400800 A1 0:45
BL2 0:30
CF1 0:15

to another workbook in this format:

Order Number Activity Code Time
400500 Z1 0:30
400600 X1 0:15
400600 P3 0:15
400800 A1 0:45
400800 BL2 0:30
400800 CF1 0:15

I've tried working with rowfields, datarange, rowrange, but all
attempts so far have failed.

Dim pt as pivottable
dim pf as pivotfield
dim rng as range
for each pf in pt.rowfields
set rng = pf.datarange
debug.print pf
for each cell in rng
if not isempty(cell) then debug.print cell
next
next

The above goes through the row fields Order Number and Activity Code.
How can I grab the Order Number when it is not shown in the table, eg
400600 for P3? Also, how can I get the Time (data field) at the same
time? Ideally I would like to iterate through each row of the pivot
table, get the data from all 3 fields and transfer it to a new
workbook.

Thanks
Tony