Solved

VBA Excel 2000 - Pivot "Paste Special as Values"

Posted on 2011-02-15
6
659 Views
Last Modified: 2016-08-25
Dear Experts,

In the daily work I am creating a lot of pivot tables, but typically needed only their numbers and not the pivot table itself with all of the wizard, formating etc functions.

So for this used to apply that selecting the pivot "arounding area", right click copy, after paste special as values. Can not do that copy on the pivot area itself and right click, because in Excel 2000 there is no copy option in the list.

Could you advise how to do it differently? Is there some command in VBA which would copy the pivot itself and paste special as values?

thanks,
0
Comment
Question by:csehz
[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
  • 3
  • 2
6 Comments
 
LVL 26

Expert Comment

by:redmondb
ID: 34897110
csehz,


Yes, this could be done in a macro, but that's not necessary.

"Copy" is missing from the Context menu (it could, of course, be added), so simply use it from the menu bar - "Edit" then "Copy", followed by the "Paste Special".

Regards,
Brian.
0
 
LVL 1

Author Comment

by:csehz
ID: 34904573
Brian thanks, but I would need this in VBA.

For example in the attached code there is a pivot with name "PivotTable8".

How this could be copied and paste to new sheet with Paste Special as Values?


ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
        "Sheet1!R1C1:R16C3").CreatePivotTable TableDestination:="", TableName:= _
        "PivotTable8"
    ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
    ActiveSheet.Cells(3, 1).Select
    ActiveSheet.PivotTables("PivotTable8").SmallGrid = False
    ActiveSheet.PivotTables("PivotTable8").AddFields RowFields:="Item", _
        ColumnFields:="Area"
    With ActiveSheet.PivotTables("PivotTable8").PivotFields("Qty")
        .Orientation = xlDataField
        .Caption = "Sum of Qty"
        .Function = xlSum
        .NumberFormat = "# ##0"
    End With

Open in new window

0
 
LVL 26

Accepted Solution

by:
redmondb earned 500 total points
ID: 34905162
csehz,

No problem...

Sub UnPivot()

ActiveSheet.PivotTables("pivottable8").TableRange2.Copy
ActiveSheet.PivotTables("pivottable8").TableRange2.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

End Sub

Open in new window


Regards,
Brian.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Closing Comment

by:csehz
ID: 34905190
Brian thanks very much.. Exactly this I searched, thanks just again
0
 
LVL 26

Expert Comment

by:redmondb
ID: 34905256
csehz,

Many thanks!

All the best,
Brian.
0
 

Expert Comment

by:Nil Rudra
ID: 41770102
Thanks I was need same code.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

763 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