How to properly setup a SourceData

E

Emmanuel

I currently have the following VB code:

Worksheets("Pivots").Activate
Range("A21").Activate
Sheets("Pivots").PivotTableWizard SourceType:=xlPivotTable, SourceData:= _
"[Fox Raven Market Share Tool 2.xls]Pivot Table!PivotTable1"

The only problem is that if I change the Excel filename, the macro does not work because it is reference the Excel Name. How can I make this query "smarter" (i.e. removing/replacing the following statement "[Fox Raven Market Share Tool 2.xls]Pivot Table!PivotTable1")

Thanks for your help,
Emmanuel
 
Top