Solved

Excel Workbook to be pasted as Values

Posted on 2012-03-14
3
193 Views
Last Modified: 2012-06-27
I have a Master file Report that has 189 Sheets.  They are one page data results per a particular sales region.  The data in the report results in multiple VLookUPs from many other data sources.  

I have to email this report, but want to copy it and paste it as values so not so large with all the look up.  How do I do this without going into each sheet copying and re pasting as values?  Can I copy the entire Workbook and past as values?
0
Comment
Question by:mishlce
  • 2
3 Comments
 
LVL 42

Expert Comment

by:dlmille
ID: 37722941
You can in a few steps.  Select each tab, all cells top left of the formula bar at the intersection of column names and row numbers, then hit Copy, PasteSpecial, Values.

Or, you can use this code:
Sub pasteValues()
Dim wkb As Workbook
Dim wks As Worksheet

    Set wkb = ActiveWorkbook
    
    For Each wks In wkb.Worksheets
        wks.Cells.Copy
        wks.Cells.PasteSpecial xlPasteValues
        Application.CutCopyMode = False
    Next wks
    MsgBox "Process Complete!"
End Sub

Open in new window


Hit ALT-F11 to go to the VBA Editor, on the left, find your workbook and click on ThisWorkbook, then Right Click and INSERT MODULE.  Copy/Paste this code, there.

Then, Run the code - e.g., hit F5 which should make that workbook values only.

Alternatively, if you have PDF Writer capability, you could print each sheet to PDF and mail that.

Hope this helps.  Let me know if you need help integrating the macro.

Dave
0
 
LVL 42

Accepted Solution

by:
dlmille earned 500 total points
ID: 37722965
I've eased this a bit, with revised code, and also you can run it and use the menu in your Add-Ins menu area.  ConvertWorkbook will convert the Active Workbook all to values.  So be careful to make a backup and save your updated workbook to a new name/location, accordingly.

Revised code:
Option Explicit

Sub pasteValues()
Dim wkb As Workbook
Dim wks As Worksheet
Dim wksStart As Worksheet

    Application.ScreenUpdating = False
    
    Set wkb = ActiveWorkbook
    Set wksStart = wkb.ActiveSheet
    
    Application.EnableEvents = False
    For Each wks In wkb.Worksheets
        wks.Cells.Copy
        wks.Cells.PasteSpecial xlPasteValues
        Application.CutCopyMode = False
        wks.Activate
        wks.Range("A1").Select
    Next wks
    Application.EnableEvents = True
    
    wksStart.Activate
    
    Application.ScreenUpdating = True
    
    MsgBox "Process Complete!"
    
End Sub

Open in new window


So, pull up the attached file, and the Add-In menus will be there.  THEN, pull up any workbook you want to convert and use the ConvertWorkbook! menu you find in the Add-Ins menu.

Cheers,

Dave
convertWkbToValues.xls
0
 

Author Closing Comment

by:mishlce
ID: 37725493
Awesome!! again huge time saver for me.  Worked perfectly!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

809 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