Jacques Geday
asked on
Pivot Table Change Data Range thru VBA
Hi
I know that you can change the SQL querry for a Pivot in something like
Activesheet.pivottables(1) .pivotcach e.commandt ext = "SELECT * FROM ....
What is the command to change the Data Range
like my pivot give me this value Sheet1!R1C1:R11C3 for SourceData
Activesheet.pivottables(1) .SourceDat a = Sheet1!R1C1:R11C3
how can I get it to point by VBA to a different range say Sheet1!$A$1:$C$1,Sheet1!$A $3:$C$9
Tks
gowflow
I know that you can change the SQL querry for a Pivot in something like
Activesheet.pivottables(1)
What is the command to change the Data Range
like my pivot give me this value Sheet1!R1C1:R11C3 for SourceData
Activesheet.pivottables(1)
how can I get it to point by VBA to a different range say Sheet1!$A$1:$C$1,Sheet1!$A
Tks
gowflow
The SourceData for a pivot table must be one contiguous range.
ASKER
then how to do it if one wants to have filtered data show in a pivot without having to everytime redesign the pivot.
gowflow
gowflow
You have to filter the pivot the same way as the source, or copy the filtered data to another area and use that as the source data. The former is easier. ;)
ASKER
ok suppose I copy and I have a contiguous range suppose it is
Sheet1!$A$3:$C$9
How do I programmatically now affect this new range to the existing pivot
gowflow
Sheet1!$A$3:$C$9
How do I programmatically now affect this new range to the existing pivot
gowflow
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great help as usual.
Tks v much
gowflow
Tks v much
gowflow