Solved

Excel Workbook to be pasted as Values

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

803 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