Link to home
Start Free TrialLog in
Avatar of csehz
csehzFlag for Hungary

asked on

VBA Excel 2000 - Pivot "Paste Special as Values"

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?

Avatar of redmondb
Flag of Afghanistan image


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".

Avatar of csehz


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:= _
    ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
    ActiveSheet.Cells(3, 1).Select
    ActiveSheet.PivotTables("PivotTable8").SmallGrid = False
    ActiveSheet.PivotTables("PivotTable8").AddFields RowFields:="Item", _
    With ActiveSheet.PivotTables("PivotTable8").PivotFields("Qty")
        .Orientation = xlDataField
        .Caption = "Sum of Qty"
        .Function = xlSum
        .NumberFormat = "# ##0"
    End With

Open in new window

Avatar of redmondb
Flag of Afghanistan image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of csehz


Brian thanks very much.. Exactly this I searched, thanks just again

Many thanks!

All the best,
Avatar of Nil Rudra
Nil Rudra

Thanks I was need same code.