Setting up a SourceData:= in VB

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
 
D

Dick Kusleika

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top