pivot table copy and paste values AND formating...

  • in excel 2010, I'm using the following to copy and paste values and formating from a pivot table, but i lose the formatting (TableStyle2 = "PivotStyleLight8"):


    Code
    Selection.CurrentRegion.Select
            Selection.Copy
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False


    i have tried to add, xlPasteFormats, but to no avail...?


    thank you.

  • Re: pivot table copy and paste values AND formating...


    You shouldnt need a pastespecial at all.


    Just a


    Code
    Selection.Copy Range("A1")


    This would paste the selection including formatting into A1

  • Re: pivot table copy and paste values AND formating...


    thank you.


    from your example, the copy does work (to another range) and the formatting stays, but so does the pivot table.
    (i'm trying to copy the values of the pivot table (this works) and also copy the pivot table formatting (.TableStyle2 = "PivotStyleLight8") - this doesn't in my example)...


    ?


    thank you.

  • Re: pivot table copy and paste values AND formating...


    and thanks to Debra Dalgleish, i used:



    this works if copied to anther range, but not if i try to copy, paste values and formats to itself (same range) and "break" pivot table...?


    thank you.

  • Re: pivot table copy and paste values AND formating...


    Try do this:


    Code
    Selection.Copy
    Selection.PasteSpecial xlPasteValues
    Selection.PasteSpecial [B]xlPasteFormats[/B]


    That should do both the values and the formats, but not the pivot I think

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!