ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting up a SourceData:= in VB (https://www.excelbanter.com/excel-programming/288783-setting-up-sourcedata-%3D-vbulletin.html)

Emmanuel[_2_]

Setting up a SourceData:= in VB
 
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

Dick Kusleika[_3_]

Setting up a SourceData:= in VB
 
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.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Emmanuel" wrote in message
...
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





All times are GMT +1. The time now is 07:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com