Solved

Excel Workbook to be pasted as Values

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
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.

706 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

17 Experts available now in Live!

Get 1:1 Help Now