+ Reply to Thread
Results 1 to 6 of 6

Update Master spreadsheet from multiple templates sheets

Hybrid View

avendi Update Master spreadsheet... 08-09-2015, 10:21 PM
natefarm Re: Update Master spreadsheet... 08-10-2015, 03:59 PM
avendi Re: Update Master spreadsheet... 08-11-2015, 12:46 AM
natefarm Re: Update Master spreadsheet... 08-11-2015, 10:30 AM
newdoverman Re: Update Master spreadsheet... 08-11-2015, 11:46 AM
newdoverman Re: Update Master spreadsheet... 08-11-2015, 11:48 AM
  1. #1
    Registered User
    Join Date
    11-09-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    80

    Update Master spreadsheet from multiple templates sheets

    Hi everyone,

    I have attached 4 sheets to exemplify my query - Example Master, Example Template 1, Example Template 2 and Example Template 3.

    I am going to receive many template files from different people and am looking for suggestions on how I can update a master file from the source data as and when it arrives, without having to copy and paste each time.

    Any assistance will be greatly appreciated.

    Cheers, Avendi
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Update Master spreadsheet from multiple templates sheets

    Would the templates be found in a specific folder, or would they arrive as email attachments?
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Registered User
    Join Date
    11-09-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    80

    Re: Update Master spreadsheet from multiple templates sheets

    Hi natefarm,

    Arrive as emails but will be put into specific folders.

    Cheers, AV

  4. #4
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Update Master spreadsheet from multiple templates sheets

    Create another sheet in the Master workbook called Templates. A1 = "Folder", B1 = "Template" for headings. Enter your folder and heading names beneath. If all the templates will be in the same folder, then you can just enter it into B2 and adjust the code to use B2 for all folders.

    Add the code below to the Templates sheet, and if you want, add a "Get Template Data" button to run the code, or you can just assign it to a shortcut key.
    Option Explicit
    Dim Folder As String, Template As String
    Dim mrow As Long, trow As Long, tnamerow As Long, mcol As Long
    
    Sub GetTemplateData()
        Application.ScreenUpdating = False
        Sheets("Templates").Select
    
        With Sheets("Sheet1")
            mrow = .Range("A" & Rows.Count).End(xlUp).Row + 1
            mcol = .Range("A1").End(xlToRight).Column
            tnamerow = 2
            Do Until Cells(tnamerow, 2).Value = ""
                Folder = Cells(tnamerow, 1).Value
                Template = Cells(tnamerow, 2).Value
                If Right(Folder, 1) <> "\" Then
                    Folder = Folder & "\"
                End If
    
                Application.StatusBar = "Opening " & Template
                Workbooks.Open Folder & Template
                trow = Range("A" & Rows.Count).End(xlUp).Row
                Range(Cells(2, 1), Cells(trow, mcol)).Copy Destination:=.Cells(mrow, 1)
                ActiveWorkbook.Close (False)
    
                mrow = .Range("A" & Rows.Count).End(xlUp).Row + 1
                tnamerow = tnamerow + 1
            Loop
    
            Application.StatusBar = False
        End With
    End Sub

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Update Master spreadsheet from multiple templates sheets

    Here is a formula based solution that would require that all workbooks retain theirs names and be open at the same time in order for this to work.
    I inserted a column at Column A of all the workbooks. In the sub workbooks there is a formula that numbers the rows that have data. This is the formula entered into A2 of each sub workbook:
    Formula: copy to clipboard
    =IF(B2<>"",MAX($A$1:A1)+1,"")

    In A1 of each sub workbook except the first this formula to retrieve the max value from column A of the previous workbook is used using the name of the previous workbook in the series :
    Formula: copy to clipboard
    =MAX('[Example Template 1.xlsx]Sheet1'!A:A)


    All of the max values in the workbooks is brought forward to the Master workbook with this formula. The names of the workbooks for this example are in BN3:BN5 and this formula is entered in BO3 and filled down:
    Formula: copy to clipboard
    =MAX(INDIRECT("'["&BN3&".xlsx]Sheet1'!A:A"))


    The above values are then used in column A of the Master workbook to determine how many rows to assign to each workbook. This formula is entered into A2 and filled down:
    Formula: copy to clipboard
    =IF(ROWS($1:1)>MAX(BO:BO),"",INDEX(BN:BN,MATCH((ROWS($A$1:A1)-1),BO:BO)+1))


    Then to retrieve the data from each workbook the following VLOOKUP formula is entered into B2 and filled across and down:
    Formula: copy to clipboard
    =IFERROR(VLOOKUP((ROWS($A$2:A2)-1)*1+1,INDIRECT("'["&$A2&".xlsx]Sheet1'!A2:BB400"),COLUMNS($A$1:B1),0),"")


    Here are your workbooks setup so that you can try out the setup.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Update Master spreadsheet from multiple templates sheets

    Trouble uploading workbooks. I'm trying again.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 03-18-2015, 10:55 AM
  2. [SOLVED] Multiple Sheets that need to update off master sheet HELP!
    By Olympiapools in forum Excel General
    Replies: 17
    Last Post: 11-17-2014, 11:05 AM
  3. Replies: 1
    Last Post: 04-14-2014, 04:11 AM
  4. update list with specific cell values in uncreate sheets (templates)
    By dmendes in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-19-2013, 03:48 AM
  5. Data Extraction Multiple Workbooks And Sheets To Master Spreadsheet
    By shido in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-04-2013, 09:11 PM
  6. Trying to build a master spreadsheet to pull hours from multiple time sheets
    By roxannek in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-06-2012, 12:28 AM
  7. Compare one spreadsheet with multiple sheets and update
    By vedamv in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-04-2007, 10:10 PM

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