Solved

Excel & VBA to create Pivot Table

Posted on 2011-03-17
4
227 Views
Last Modified: 2012-05-11
I recorded a Macro of me creating a pivot table then attempted to step through the execution (after removing the one I had created) and I get an error on this line;
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "NRDetails[#All]", Version:=xlPivotTableVersion12).CreatePivotTable _
        TableDestination:="Not Ready Summary!R3C1", TableName:="PivotTable1", _
        DefaultVersion:=xlPivotTableVersion12

Open in new window


"NRDetails[#All]" refers to a table on another worksheet.
I've tried changing the name of the worksheet in case there was a remnant in memory of the table name but that didn't change anything.
What am I missing?
0
Comment
Question by:bouscal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 35158391
Is the data sheet active when you run the code?
0
 
LVL 7

Author Comment

by:bouscal
ID: 35158530
Get an 'invalid procedure call' no matter which sheet is active.
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 35158571
Does the Not Ready Summary sheet exist? If so, try changing the destination argument to:
"'Not Ready Summary'!R3C1"
rather than:
"Not Ready Summary!R3C1"

Note the single quotes around the sheet name.
1
 
LVL 7

Author Closing Comment

by:bouscal
ID: 35159074
Thank you, the single quotes made it work!!
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question