Setting up a SourceData:= in VB

  • Thread starter Thread starter Emmanuel
  • Start date Start date
E

Emmanuel

I currently have the following code written in VB:

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

How can I make this code smarter (I'd like to remove the
[Fox Raven Market Share Tool 2.xls] reference from it.

Thanks for your help,
Emmanuel
 
Emmanuel

OK, go ahead and do it. It looks like Pivot Table is the name of the sheet
in Fox Raven Market Share Tool 2.xls, so if you remove the file name, it
will look for a sheet in the current workbook with that name.

I haven't actually tried it, but it should work.
 
Back
Top