Solved

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

Posted on 2012-03-22
3
272 Views
Last Modified: 2012-03-25
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
Comment
Question by:Duchenne
[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
3 Comments
 
LVL 42

Expert Comment

by:dlmille
ID: 37755947
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
 
LVL 42

Accepted Solution

by:
dlmille earned 500 total points
ID: 37755964
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
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 37756481
When you do a normal paste, you should get a smart tag appear with the option to paste values and formatting.
0

Featured Post

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!

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;…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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…

740 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