Results 1 to 29 of 29

Creating New Workbooks From Worksheets in Different Workbooks

Threaded View

  1. #1
    Registered User
    Join Date
    06-23-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2007
    Posts
    47

    Creating New Workbooks From Worksheets in Different Workbooks

    I have sales reports that need to be created from two different workbooks that contain worksheets that need to be put into new workbooks. In the "Revenue" workbook there are two sheets entitled "Revenue by Territory" and "Territory by Volume" that are summaries of the total sales data by each territory. These two sheets should be pasted into each new workbook created. In the "Revenue" workbook there are unique additional worksheets(approximately 70) and one of these worksheets should be pasted into its own workbook along with the two summary worksheets"Revenue by Territory" and "Volume by Territory". In the "Volume" workbook there are sheets that need to be added to the new workbooks created from the "Revenue" data. These sheets are all in the same order in both the "Revenue" and "Volume" workbooks, and have the same names with the exception of a "vol" and "rev" added to the end. I have tried to put together some code borrowed from Jbeaucaire for the first part of this, but there are obvious problems with it and it is incomplete. Any help with this would be greatly appreciated.

    Sub SheetsToBooks()
    'Jerry Beaucaire  (10/22/2009)
    'Creates a separate workbook for each sheet, saved with sheetname + Date
    Dim ws As Worksheet, savePath As String, MyStr As String
    
    savePath = "C:\Users\Documents\"   'do not forget the closing \ in this string
    
        For Each ws In ThisWorkbook.Worksheets
                  Sheets(Array("Revenue by Territory", "Volume by Territory")).Select
                  Sheets("Volume by Territory").Activate
                  Sheets(Array("Revenue by Territory", "Volume by Territory")).Copy
            MyStr = ws.Name & " " & Format(Date, "mm-dd-yy")
            ws.Copy        'copies sheet to new workbook
            Cells.Copy     'removing all formulas
            Range("A1").PasteSpecial xlPasteValues
            ActiveWorkbook.SaveAs Filename:=savePath & MyStr, FileFormat:=xlNormal
            
        Next ws
    
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1