Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Fei Fei is offline
external usenet poster
 
Posts: 5
Default "Run-Time Error '1004'

Hi all,

When I run my VBA, there was a message:

"Run-Time Error '1004':

The pivotTable field name is not valid. To create a pivottable report,
you must use data that is organized as a list with labeled columns. If
you are changing the name of a pivottable field, you must type a new
name for the field."

It occurred when running:
Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=PRange.Address)
Set PT = PTCache.CreatePivotTable(TableDestination:=shhet1. Range
("A1"), _
TableName:="PovitTable1")

Any help is appreciated

Fei
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default "Run-Time Error '1004'

Hi,
You can try changing ActiveWorkbook.PivotCaches.Add to ActiveWorkbook.
PivotCaches.Create


Fei wrote:
Hi all,

When I run my VBA, there was a message:

"Run-Time Error '1004':

The pivotTable field name is not valid. To create a pivottable report,
you must use data that is organized as a list with labeled columns. If
you are changing the name of a pivottable field, you must type a new
name for the field."

It occurred when running:
Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=PRange.Address)
Set PT = PTCache.CreatePivotTable(TableDestination:=shhet1. Range
("A1"), _
TableName:="PovitTable1")

Any help is appreciated

Fei


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200901/1

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default "Run-Time Error '1004'

Hard to tell without seeing the source data, but maybe try one of these...

Set PT = PTCache.CreatePivotTable(TableDestination:=shhet1. Range

Did you mean "sheet1" ?

SourceData:=PRange.Address

Try just
SourceData:=PRange

Tim


"Fei" wrote in message
...
Hi all,

When I run my VBA, there was a message:

"Run-Time Error '1004':

The pivotTable field name is not valid. To create a pivottable report,
you must use data that is organized as a list with labeled columns. If
you are changing the name of a pivottable field, you must type a new
name for the field."

It occurred when running:
Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=PRange.Address)
Set PT = PTCache.CreatePivotTable(TableDestination:=shhet1. Range
("A1"), _
TableName:="PovitTable1")

Any help is appreciated

Fei



  #4   Report Post  
Posted to microsoft.public.excel.programming
Fei Fei is offline
external usenet poster
 
Posts: 5
Default "Run-Time Error '1004'

Thanks all!

I have tried “create” - but not working.....

Sheet1 is the name of my worksheet, which contains my Pivot table –
“Dim Sheet1=Worksheets(Pivot Table)”. As the table and data are in two
worksheets, i have to specify the sheet name...

Also, after the run-time error 1004, when i continue to run the codes,
there is another error - "run-time error '-2147417848(80010108)":
Method 'CreatePivoteTable' of object 'PivotCache' failed'"....

I followed the sample codes, and the data is normal dataset......not
sure why...

Thanks

Fei
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I correct a "run time error 1004-unable to open" problem? BillR Excel Programming 1 August 26th 08 07:21 PM
"run-time error '1004' - select method of range failed" maemi weirdoke Excel Programming 2 March 5th 08 03:15 PM
Run-time error "1004" Select method of range class failed Tallan Excel Discussion (Misc queries) 3 March 7th 07 05:22 PM
Run time error 1004: "No list was found.." hachiroku[_5_] Excel Programming 1 May 22nd 06 12:53 PM
"Run-time error '1004'" Method 'Range' of object '_global' failed. haisat[_2_] Excel Programming 0 October 20th 03 12:13 PM


All times are GMT +1. The time now is 07:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"