Pivot Table in Macro


Posted by Scott on February 06, 2001 12:28 PM

When one uses the Pivot Table Wizard in Excel 2000, the Wizard automatically selects the body of the database that will be referenced.

How can this auto-feature be applied in a Macro? When I try to record one with the Pivot Table Wizard, it places an explicit reference to a Range, and this will not work with the different databases. I need the auto-select function of the Pivot Table Wizard.

Any ideas? Thanks.

Posted by Dave Hawley on February 06, 2001 12:39 PM

Hi scott

The SourceData code below will work so long as the selected cell joins to the headings in some way.


SourceData:= _
ActiveSheet.Name & "!" & Selection.CurrentRegion.Address

Hope this helps

Dave


OzGrid Business Applications

Posted by Tony Sorace on February 08, 2001 10:21 PM

This is the same question that I'd wish to ask, but it differs in that I will be using the same imformation from my data, but during the day, people will be adding data to it, and on order to use the "grouping" feature, I can't just make the pivot table "x" range



Posted by Scott on February 12, 2001 11:33 AM


Dave,


It works great! Thanks so much!


-Scott