Solved

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

Posted on 2012-03-22
3
279 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

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

717 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