View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default how can I get the worksheet with the pivottable sourcedata whe

Here is more inof to help you solve your problem. the main problem is
SourceData return r1C1 format and a Range() statement requires regular
addressing. See code below


Sub test()

Set pt = ActiveChart.PivotLayout.PivotTable ' no problem to
' get the pivottable
DataRangeR1C1 = pt.SourceData
DataRange = Application.ConvertFormula( _
Formula:=DataRangeR1C1, _
fromReferenceStyle:=xlR1C1, _
toReferenceStyle:=xlA1)
Set data = Range(DataRange)
For Each cell In data
'enter your code here
Next data
End Sub

"minimaster" wrote:

I'm not sure how that will help me to identify the worksheet name with
the source data. May be I don't see the forest because there are so
many trees.
Your suggestion "data=pt.sourcedata" only provides me with a string,
or do I' missing something here?