Solved

Excel Workbook to be pasted as Values

Posted on 2012-03-14
3
191 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 41

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 41

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

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

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
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…
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 demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

939 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

4 Experts available now in Live!

Get 1:1 Help Now