View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kevin McCartney Kevin McCartney is offline
external usenet poster
 
Posts: 67
Default HOW TO: PivotTable.SourceData

and he correct answer is

pt.SourceData = wsDATA.Name & "!" &
wsDATA.Range("A1").AddressLocal(ReferenceStyle:=xl R1C1) & ":" &
wsDATA.Cells.SpecialCells(xlCellTypeLastCell).Addr essLocal(ReferenceStyle:=xlR1C1)

To use "AddressLocal" and not "Address"

HTH someone else too

"Kevin McCartney" wrote:

I thought FormulaR1C1Local might help but I still can't get it to work, can
any one help,

cheers

I've been trying to update the source data range of my pivot tables on all my
worksheets within a workbook and I've been using the following code

pt.SourceData = wsDATA.Name & "!R1C1:" &
wsDATA.Cells.SpecialCells(xlCellTypeLastCell).Addr ess(ReferenceStyle:=xlR1C1)

This works great while its on an English machine but if I change the
Regional Setting e,g, to Germany then it fails because of the xlR1C1
reference style because the returns e.g. R1C1:R4500C62 but German setting
require Z4500S62

So the question is how do I set the source data of a pivot table using the
xlR1C1 style of the machine settings since if I question mark ?pt.SourceData
I get the
xlR1C1 style. Hence if I try to use xlA1 reference style that too fails.

Any help much appreciated

ciao
KM