ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trouble recreating Pivot table changes in VBA (https://www.excelbanter.com/excel-programming/294934-trouble-recreating-pivot-table-changes-vba.html)

andycharger[_23_]

Trouble recreating Pivot table changes in VBA
 
Im having some problems with my pivot table changes in VBA

I am calling my pivot table up like below but when I add the sourcetyp
and sourcedata, it gives me the following error:

Run Time Error '1004';
The Pivot table field name is not valid. To create a pivot tabl
report, you must use data that is organised as a list with labelle
columns. If you are changing the name of a pivot table field , you mus
type a new name for the field

Here is my code:
[vb]
Sheets("source Code").Activate
ActiveSheet.PivotTableWizard SourceType:=xlDataBase
SourceData:="'!Quotes 2004' !$a$1:$k$6336"
ActiveWorkBook.ShowPivotTableFieldList = True
[/vb]

Anyone shed any light on this

--
Message posted from http://www.ExcelForum.com


BrianB

Trouble recreating Pivot table changes in VBA
 
It is much easier to record a macro when making up a pivot table an
amend that as necessary

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 05:53 AM.

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