+ Reply to Thread
Results 1 to 9 of 9

Consolidation of workbooks in the same file to a single sheet in a master

Hybrid View

  1. #1
    Registered User
    Join Date
    11-09-2011
    Location
    Central Coast NSW
    MS-Off Ver
    Excel 2003
    Posts
    5

    Consolidation of workbooks in the same file to a single sheet in a master

    Hi, I have just developed an automated purchase order form that the users save in a daily folder, with a different file name of each new purchase order. What I need to do is to put certain information from selected cells of these forms into a summary workbook to provide the owner with a daily summary of orders made. I know it can be done, but the consolidation program I have is for a much more complex consolidation. Does anyone have a simple consolidation program that will just take information from certain cells and put in in a summary?
    Last edited by Jaspabl; 11-10-2011 at 12:27 AM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Consolidation of workbooks in the same file to a single sheet in a master

    hi Jaspabl
    Weclome to the forum
    Jerry has many examples herehttps://sites.google.com/a/madrocket.../wbs-to-sheets
    Last edited by pike; 11-10-2011 at 06:59 PM.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    11-09-2011
    Location
    Central Coast NSW
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Consolidation of workbooks in the same file to a single sheet in a master

    Thanks Pike, I think I have found what I need. Just need to customise, which I think is not a friday job! Brain dead from 2 weeks of designing, developing and training users....

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Consolidation of workbooks in the same file to a single sheet in a master

    hi Jaspabl

    how did it go ?

  5. #5
    Registered User
    Join Date
    11-09-2011
    Location
    Central Coast NSW
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Consolidation of workbooks in the same file to a single sheet in a master

    Still batteling on. The 4 options don't seem to quite do it. Very frustrating! All I need it to do is to go to each file, select a certain sheet and copy 1 line to be pasted into a master sheet in the consolodation spreadsheet to create a list that will be totaled on the bottom line of the sheet. I must be missing something somewhere!

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Consolidation of workbooks in the same file to a single sheet in a master

    Can you adapt this one
    Option Explicit
    
    Sub ConsolidateSheetsFromWorkbooks()
    'Author:    Jerry Beaucaire, ExcelForum.com
    'Date:      1/5/2011
    'Summary:   Open all files in a folder and merge data (stacked) on all
    '           sheets into main wb matching the sheet names.
    '           Assumes all sheets with titles exist in main book and
    '           data sheets data starts at row 2
    Dim wbData As Workbook, wbMain As Workbook
    Dim wsMain As Worksheet, wsData As Worksheet
    Dim LR As Long, NR As Long
    Dim fPath As String, fName As String
    
    Set wbMain = ThisWorkbook
    
                                        'if files are stored in separate directory edit fPath
    fPath = ThisWorkbook.Path & "\"     'don't forget the final \
                                        
    fName = Dir(fPath & "*.xls")        'start looping through files one at a time
    Application.ScreenUpdating = False
    
        Do While Len(fName) > 0
            If fName <> ThisWorkbook.Name Then
                Set wbData = Workbooks.Open(fPath & fName)
                For Each wsData In wbData.Worksheets
                    Set wsMain = wbMain.Sheets(wsData.Name)
                    NR = wsMain.Range("A" & Rows.Count).End(xlUp).Row + 1
                    With wsData
                        LR = .Range("A" & .Rows.Count).End(xlUp).Row
                        .Range("A2:A" & LR).EntireRow.Copy wsMain.Range("A" & NR)
                    End With
                Next wsData
                
                wbData.Close False
            End If
            
            fName = Dir                 'queue up next filename
        Loop
    
    Application.ScreenUpdating = True
    End Sub

  7. #7
    Registered User
    Join Date
    11-09-2011
    Location
    Central Coast NSW
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Consolidation of workbooks in the same file to a single sheet in a master

    Hi Pike, I have it almost working with one tiny problem, that defeats the whole purpose of the spreadheets! What I need it to do is to find the next row without data and select the cell in columnA and paste the values. Currently it just pastes in row 2 (I know it will be something to do with the "Range ("A2:A" & LR):

    Application.ScreenUpdating = False
    Sheets("Form accS2").Select
    Range("B2").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Date = Range("B2").Value
    PO = Range("B9").Value


    Sheets("Form accS2").saveas Filename:="C:\Documents and Settings\Julie Anderson\My Documents\Dropbox\Beecham\Audi Central Coast WIP\Automation\" & Year(Now) & "-" & Month(Now) & "-" & Day(Now) & "_" & PO & ".xls"


    Application.ScreenUpdating = True
    ActiveWindow.SelectedSheets.PrintOut Copies:=1

    Sheets("Purchases").Select
    Range("A2:I2").Copy

    Workbooks.Open ("Draft Daily Tracking Spreadsheet.xlsm")
    Sheets("purchases").Select
    LR = Cells.Find("*", Cells(Rows.Count, Columns.Count), _
    SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Range("A2:A" & LR).EntireRow.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    Workbooks("Draft Daily Tracking Spreadsheet.xlsm").Save

  8. #8
    Registered User
    Join Date
    11-09-2011
    Location
    Central Coast NSW
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Consolidation of workbooks in the same file to a single sheet in a master

    Very pleased to say I have finally solved my problem. Just had a total blank about it, and it was a fairly easy fix in the end (I hope this can help others out there). Both files need to be in the same folder:

    Sub dailyreport()
    Application.ScreenUpdating = False
    Sheets("Form accS2").Select
    Range("B2").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Date = Range("B2").Value
    PO = Range("B9").Value


    Sheets("Form accS2").saveas Filename:="C:\(File Path)" & Year(Now) & "-" & Month(Now) & "-" & Day(Now) & "_" & PO & ".xls"


    Application.ScreenUpdating = True
    ActiveWindow.SelectedSheets.PrintOut Copies:=1

    Sheets("Purchases").Select
    Range("A2:I2").Copy

    Workbooks.Open ("Draft Daily Tracking Spreadsheet.xlsm")
    Sheets("purchases").Select
    NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
    Cells(NextRow, 1).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Workbooks("Draft Daily Tracking Spreadsheet.xlsm").Save

    End Sub

  9. #9
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Consolidation of workbooks in the same file to a single sheet in a master

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

+ Reply to Thread

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