Solved

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

Posted on 2012-03-22
3
244 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
  • 2
3 Comments
 
LVL 41

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 41

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
time format showing wrong 12 49
Hiding column macro 10 28
Delete texts with font color 16 30
Incorporate VBA Code to work with Original Workbook 23 27
INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
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…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

932 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now