[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

Excel 2007 - Can I Use "Paste Special" to paste Values AND Formatting?

I have constructed a spreadsheet with VLOOKUP formulas, as well as some simple SUM formulas.  I have also used some basic formatting (cell fill colors, bold fonts, some merged cells, etc.) to help in making reading certain cells/columns easier to identify quickly.

Each week, I need to copy the entered and calculated information, paste the data into it's own worksheet (data only - no formulas) and then start over with the original template and it's formulas with the next week's data.  

Of course, I know how to paste values only, but then I am required to make a number of manual steps with the pasted data (centering of text in some columns, adjusting the date column to the correct format, etc.) to keep the data easily readable.

With this spreadsheet retaining merged cells isn't that important but retaining the visual/style formatting is.

Is there a way to "Paste Special" that will paste the cell Values AND Formatting, retaining all the shading, bold fonts, date style, merged cells, merged cells, etc?

Thanks to all.
0
Duchenne
Asked:
Duchenne
  • 2
1 Solution
 
dlmilleCommented:
No, unfortunately it has to be in two steps.

Use this code and set a control key to run this macro (perhaps in your personal.xls(b)?)
Sub pasteValuesAndFormats()

    With ActiveCell
        .PasteSpecial xlPasteFormats
        .PasteSpecial xlPasteValues
    End With
    
End Sub

Open in new window


Let me know if you need further assistance.

Dave
0
 
dlmilleCommented:
I reposted the code above, after some testing, to make it a bit cleaner.


Hit Alt-F11 to get to the VBA editor.  Look to the left and seek out your workbook name, click right on where it says VBProject(your workbookname) and select Insert Module.

Then paste the code I posted (above).

You can close the VBA editor and go back to your workbook by hitting the excel icon on the top/left or just hit the X at the top right.

Then, Tools->Macros (or Ribbon Developer->Macros) select the macro name "pasteValuesAndFormats" and then click Options button and assign your short-cut key.

From that point forward, you can then use that control sequence to run the macro and do both paste values and formats!

HTH

Dave
0
 
Rory ArchibaldCommented:
When you do a normal paste, you should get a smart tag appear with the option to paste values and formatting.
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!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now