MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Macro for Pivot Table

Posted by Dee on May 17, 2001 8:02 AM

How do you write the code for a pivot table when the data's range is always changing? Sometimes I will have 200 rows, sometimes 10 rows of data.

Posted by Mark W. on May 17, 2001 8:09 AM

Assign the default name, "Database", to the data
list range, redefine that name as needed with the
data list is extended, and refer to the name
"Database" at "Step 2 of 4" of the PivotTable

Posted by Dave Hawley on May 17, 2001 9:24 PM

Hi Dee

"Dynamic Ranges" are ideal for Pivot Tables and Charts. I have many examples of them on my Website (OzGrid Business Applications) under "Dynamic Ranges" the will help you out.


OzGrid Business Applications

Posted by Dave Hawley on May 17, 2001 9:28 PM


If you are still wanting code to do this, have a look at my "VBA Tips and Tricks" Page there is an example of how to redefine a range automatically.

OzGrid Business Applications