<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Referencing Pivot Table Ranges in VBA</title>
	<atom:link href="http://peltiertech.com/WordPress/referencing-pivot-table-ranges-in-vba/feed/" rel="self" type="application/rss+xml" />
	<link>http://peltiertech.com/WordPress/referencing-pivot-table-ranges-in-vba/</link>
	<description>Peltier Tech Excel Charts and Programming Blog</description>
	<lastBuildDate>Wed, 10 Mar 2010 22:37:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Gaetan</title>
		<link>http://peltiertech.com/WordPress/referencing-pivot-table-ranges-in-vba/comment-page-1/#comment-27257</link>
		<dc:creator>Gaetan</dc:creator>
		<pubDate>Fri, 19 Feb 2010 16:58:38 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2310#comment-27257</guid>
		<description>That&#039;s what I was thinking.

Thanks for confirming.

Gaetan</description>
		<content:encoded><![CDATA[<p>That&#8217;s what I was thinking.</p>
<p>Thanks for confirming.</p>
<p>Gaetan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/referencing-pivot-table-ranges-in-vba/comment-page-1/#comment-27247</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Fri, 19 Feb 2010 15:29:26 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2310#comment-27247</guid>
		<description>Gaetan -

In general there isn&#039;t any real inconvenience to cycling through items in VBA. The computer does it behind the scenes, and if there isn&#039;t a huge number of items, the user will not notice.</description>
		<content:encoded><![CDATA[<p>Gaetan -</p>
<p>In general there isn&#8217;t any real inconvenience to cycling through items in VBA. The computer does it behind the scenes, and if there isn&#8217;t a huge number of items, the user will not notice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaetan</title>
		<link>http://peltiertech.com/WordPress/referencing-pivot-table-ranges-in-vba/comment-page-1/#comment-27245</link>
		<dc:creator>Gaetan</dc:creator>
		<pubDate>Fri, 19 Feb 2010 14:20:30 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2310#comment-27245</guid>
		<description>Jon -

I think I should only look at rowfield and columnfield for &quot;data&quot; as I don&#039;t think &quot;data&quot; could be a datafields, neither could be a pagefield.

That said, as I don&#039;t know in advance what will be the orientation of the data, I preffer to scan every possibility (I guess this could be specific to my problem).

Beside the speed, do you see any other inconvenient?

Thank you for your answer.

Gaetan</description>
		<content:encoded><![CDATA[<p>Jon -</p>
<p>I think I should only look at rowfield and columnfield for &#8220;data&#8221; as I don&#8217;t think &#8220;data&#8221; could be a datafields, neither could be a pagefield.</p>
<p>That said, as I don&#8217;t know in advance what will be the orientation of the data, I preffer to scan every possibility (I guess this could be specific to my problem).</p>
<p>Beside the speed, do you see any other inconvenient?</p>
<p>Thank you for your answer.</p>
<p>Gaetan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/referencing-pivot-table-ranges-in-vba/comment-page-1/#comment-27244</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Fri, 19 Feb 2010 14:09:19 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2310#comment-27244</guid>
		<description>Gaetan -

Instead of searching for each pivot field in YourPivotTable.PivotFields, try one of these:

For Each PvtFld In YourPivotTable.PageFields
For Each PvtFld In YourPivotTable.RowFields
For Each PvtFld In YourPivotTable.ColumnFields
For Each PvtFld In YourPivotTable.DataFields</description>
		<content:encoded><![CDATA[<p>Gaetan -</p>
<p>Instead of searching for each pivot field in YourPivotTable.PivotFields, try one of these:</p>
<p>For Each PvtFld In YourPivotTable.PageFields<br />
For Each PvtFld In YourPivotTable.RowFields<br />
For Each PvtFld In YourPivotTable.ColumnFields<br />
For Each PvtFld In YourPivotTable.DataFields</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaetan</title>
		<link>http://peltiertech.com/WordPress/referencing-pivot-table-ranges-in-vba/comment-page-1/#comment-27237</link>
		<dc:creator>Gaetan</dc:creator>
		<pubDate>Fri, 19 Feb 2010 10:41:36 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2310#comment-27237</guid>
		<description>Great post, extremely useful as an introduction.

Question : 
When you have two calculations, we then have a pivot field names &quot;data&quot; (données in french). In order to keep international compatiblity, do you know a way to capture the range of this cell.

Thanks a lot.</description>
		<content:encoded><![CDATA[<p>Great post, extremely useful as an introduction.</p>
<p>Question :<br />
When you have two calculations, we then have a pivot field names &#8220;data&#8221; (données in french). In order to keep international compatiblity, do you know a way to capture the range of this cell.</p>
<p>Thanks a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig</title>
		<link>http://peltiertech.com/WordPress/referencing-pivot-table-ranges-in-vba/comment-page-1/#comment-24660</link>
		<dc:creator>Craig</dc:creator>
		<pubDate>Tue, 29 Dec 2009 18:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2310#comment-24660</guid>
		<description>Hmm, that is an interesting way of approaching this problem, and one that I had not considered before. I&#039;ll give it a shot and let you know if it works. The concept seems like it should, though.

Thanks a lot!</description>
		<content:encoded><![CDATA[<p>Hmm, that is an interesting way of approaching this problem, and one that I had not considered before. I&#8217;ll give it a shot and let you know if it works. The concept seems like it should, though.</p>
<p>Thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/referencing-pivot-table-ranges-in-vba/comment-page-1/#comment-24651</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Tue, 29 Dec 2009 15:52:11 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2310#comment-24651</guid>
		<description>Hi Craig -

I think this could be done with UDFs. One approach is to create a UDF like this (untested):

&lt;pre class=&quot;vbasmall&quot;&gt;&lt;code&gt;Public Function PivotRange(SheetName As String, PivotName As String, _&lt;br /&gt;    FieldName As String, ItemName As String) As Range&lt;br /&gt;  If Len(ItemName) &gt; 0 Then&lt;br /&gt;    Set PivotRange = ActiveWorkbook.Worksheets(SheetName).PivotTables(PivotName). _&lt;br /&gt;        PivotFields(FieldName).PivotItems(ItemName).DataRange&lt;br /&gt;  Else&lt;br /&gt;    Set PivotRange = ActiveWorkbook.Worksheets(SheetName).PivotTables(PivotName). _&lt;br /&gt;        DataRange&lt;br /&gt;  End If&lt;br /&gt;End Function&lt;/code&gt;&lt;/pre&gt;

You could then call it like:

&lt;pre class=&quot;vbasmall&quot;&gt;&lt;code&gt;=Slope(PivotRange(&quot;Sheet1&quot;,&quot;PivotTable01&quot;,&quot;Years&quot;,&quot;2004&quot;),&lt;br /&gt;PivotRange(&quot;Sheet1&quot;,&quot;PivotTable01&quot;,&quot;OrderDate&quot;,&quot;&quot;))&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi Craig -</p>
<p>I think this could be done with UDFs. One approach is to create a UDF like this (untested):</p>
<pre class="vbasmall"><code>Public Function PivotRange(SheetName As String, PivotName As String, _    FieldName As String, ItemName As String) As Range  If Len(ItemName) &gt; 0 Then    Set PivotRange = ActiveWorkbook.Worksheets(SheetName).PivotTables(PivotName). _        PivotFields(FieldName).PivotItems(ItemName).DataRange  Else    Set PivotRange = ActiveWorkbook.Worksheets(SheetName).PivotTables(PivotName). _        DataRange  End IfEnd Function</code></pre>
<p>You could then call it like:</p>
<pre class="vbasmall"><code>=Slope(PivotRange("Sheet1","PivotTable01","Years","2004"),PivotRange("Sheet1","PivotTable01","OrderDate",""))</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig</title>
		<link>http://peltiertech.com/WordPress/referencing-pivot-table-ranges-in-vba/comment-page-1/#comment-24628</link>
		<dc:creator>Craig</dc:creator>
		<pubDate>Tue, 29 Dec 2009 06:17:15 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2310#comment-24628</guid>
		<description>Jon this is quite a useful article. Definitely the closest thing I&#039;ve found to what I&#039;m looking for. I was hoping this might be an appropriate place to take me the last step. 

I see above that using VBA, there are easy ways to return whole ranges from a pivot table that will dynamically resize. However, is there a way to fetch a pivot table range from a formula that might reside on another worksheet? Basically, I have two separate pivot tables that contain some different data. I also have some formulas on another worksheet that reference ranges in both of these tables to do some calculations; for example, one of my formulas would include LINEST(). In my formulas, I would like to reference the pivot table ranges, which may change as I manipulate what&#039;s displayed on the pivot table. Is this possible to do with formulas? All I can find so far is the GETPIVOTDATA() function, but the documentation indicates that this is only for the summary data, whereas I want to operate on the range itself.

Regards,
Craig</description>
		<content:encoded><![CDATA[<p>Jon this is quite a useful article. Definitely the closest thing I&#8217;ve found to what I&#8217;m looking for. I was hoping this might be an appropriate place to take me the last step. </p>
<p>I see above that using VBA, there are easy ways to return whole ranges from a pivot table that will dynamically resize. However, is there a way to fetch a pivot table range from a formula that might reside on another worksheet? Basically, I have two separate pivot tables that contain some different data. I also have some formulas on another worksheet that reference ranges in both of these tables to do some calculations; for example, one of my formulas would include LINEST(). In my formulas, I would like to reference the pivot table ranges, which may change as I manipulate what&#8217;s displayed on the pivot table. Is this possible to do with formulas? All I can find so far is the GETPIVOTDATA() function, but the documentation indicates that this is only for the summary data, whereas I want to operate on the range itself.</p>
<p>Regards,<br />
Craig</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fernando</title>
		<link>http://peltiertech.com/WordPress/referencing-pivot-table-ranges-in-vba/comment-page-1/#comment-23447</link>
		<dc:creator>Fernando</dc:creator>
		<pubDate>Sat, 05 Dec 2009 18:49:55 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2310#comment-23447</guid>
		<description>dear:
In your article you datarange reference data, as I do to reference a data item in the grand total column using de intersect property:

in the example
pt.DataBodyRange.Select

as I do to select in the row

Order Date &quot;Jan&quot; Grand Total &quot;42447,15&quot;

this cell is not inside in the datarange ?.
as do I reference the column grand total ?

thanks you very much</description>
		<content:encoded><![CDATA[<p>dear:<br />
In your article you datarange reference data, as I do to reference a data item in the grand total column using de intersect property:</p>
<p>in the example<br />
pt.DataBodyRange.Select</p>
<p>as I do to select in the row</p>
<p>Order Date &#8220;Jan&#8221; Grand Total &#8220;42447,15&#8243;</p>
<p>this cell is not inside in the datarange ?.<br />
as do I reference the column grand total ?</p>
<p>thanks you very much</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Final Impact</title>
		<link>http://peltiertech.com/WordPress/referencing-pivot-table-ranges-in-vba/comment-page-1/#comment-22110</link>
		<dc:creator>Final Impact</dc:creator>
		<pubDate>Thu, 12 Nov 2009 18:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2310#comment-22110</guid>
		<description>Hi Jon and thanks for the above info it was helpful and insightful! 
I am however at a loss as to how to do something simple and use cells from a sheets range like f2 to f32 to make items in a Pivot field &#039;PivotItems Visible = True&#039;. I&#039;ve recorded macros and attempted to automate the process but I&#039;m missing something. (Too many problems to list)

The PT comes from a table of test records with 30 columns and 15k rows. My PT is setup but I have to manually uncheck &quot;Show All&quot; and search for and check-off 200 serial numbers in column 1 of the PT every three days. 
Can I point my vb code to a list or range cells and exclude everything in the column which is not in the column I specifiy (f2:f32 or A1 to A201) from another sheet?
PT headers are as follows: SERIAL_NUM, CAL_DATE, CAL_TIME, SLOT, ERROR_MESS, ect. and all I need is SERIAL_NUM visible equal to true for 200 of the 15k serial numbers available. Does this make sense?

Thanks for any input.
Final Impact</description>
		<content:encoded><![CDATA[<p>Hi Jon and thanks for the above info it was helpful and insightful!<br />
I am however at a loss as to how to do something simple and use cells from a sheets range like f2 to f32 to make items in a Pivot field &#8216;PivotItems Visible = True&#8217;. I&#8217;ve recorded macros and attempted to automate the process but I&#8217;m missing something. (Too many problems to list)</p>
<p>The PT comes from a table of test records with 30 columns and 15k rows. My PT is setup but I have to manually uncheck &#8220;Show All&#8221; and search for and check-off 200 serial numbers in column 1 of the PT every three days.<br />
Can I point my vb code to a list or range cells and exclude everything in the column which is not in the column I specifiy (f2:f32 or A1 to A201) from another sheet?<br />
PT headers are as follows: SERIAL_NUM, CAL_DATE, CAL_TIME, SLOT, ERROR_MESS, ect. and all I need is SERIAL_NUM visible equal to true for 200 of the 15k serial numbers available. Does this make sense?</p>
<p>Thanks for any input.<br />
Final Impact</p>
]]></content:encoded>
	</item>
</channel>
</rss>
