John knows how to create a copy of a worksheet, but he needs to create a copy that uses only static values, not values based on formulas. He wonders if there is a quick way to make a copy (perhaps with a macro) that maintains all formatting and column widths, but has all formulas replaced with their results. For the work John does this would be very helpful in sending out worksheets to individuals outside his organization.
This task is rather easy to accomplish, with or without a macro. If you want to do it without a macro, follow these steps:
- Right-click on the worksheet tab of the worksheet you want to copy. Excel displays a Context menu.
- Choose Move or Copy Sheet from the Context menu. Excel displays the Move or Copy dialog box. (See Figure 1.)
- Check the Create a Copy check box.
- Using the To Book pull-down list, choose New Book.
- Click OK. Excel copies the worksheet to a new workbook.
- Make sure the newly created workbook is the one displayed.
- Select all the cells in the worksheet by pressing Ctrl+A.
- Copy all the cells to the Clipboard by pressing Ctrl+C.
- Display the Home tab of the ribbon.
- Click the down-arrow under the Paste tool. Excel displays some different ways you can paste information.
- Choose the Values option; it looks like an icon that has 123 on it.
Figure 1. The Move or Copy dialog box.
That’s it. Your newly created worksheet doesn’t contain any formulas, only the results of the formulas in the original worksheet. If you prefer to use a macro-based approach, it only takes a few lines of code:
Sub CopyWorksheetValues() ActiveSheet.Copy Cells.Copy Range("A1").PasteSpecial Paste:=xlPasteValues Application.CutCopyMode = False End Sub
Of course, if you want to distribute only the results of your worksheet, you might consider simply printing a PDF file and then distributing it. The added benefit is that your recipients don’t need to have Excel to view it. The downside is that if your worksheet is very large, a PDF file can be rather unwieldy.