I am trying to automatically mail some reports (which are essentially Pivot Tables) using VBA script. I have multiple Pivot tables in some of my sheets. How do I ensure that a particular Pivot Table is always indexed as 1.
Example:
On a worksheet I two Pivot Tables - PvtTable1 & PvtTable2. In my VBA code, when I reference a Pivot Table using the code, ActiveSheet.PivotTables(1) I want it to always refer it to PvtTable1. Not PvtTable. How can I do that? I don't want to refer my Pivot Tables using their names, as I intend to use my VBA code in a FOR LOOP.
Dim current As Worksheet
For Each current In Worksheets
<my VBA Code statements>
Set PvtTableRng = current.PivotTables(1).TableRange1
<some more VBA Code>
Next