+ Reply to Thread
Results 1 to 4 of 4

Automatically combining multiple excels into one

Hybrid View

  1. #1
    Registered User
    Join Date
    10-12-2020
    Location
    Tel Aviv,Israel
    MS-Off Ver
    Office 365
    Posts
    2

    Question Automatically combining multiple excels into one

    Hi All

    I have multiple excels being uploaded to a shared folder every week and I'd like to create a master excel sheet that whenever someone drops an excel into this folder it
    automatically appends it to the master file all the excels are formatted as table and all have identical columns

    Thanks

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Automatically combining multiple excels into one

    Hi,

    Here's the general approach I use.

    Sub Open_All_Files()
        Dim oWbk As Workbook, wb as Workbook
        Dim sFil As String
        Dim sPath As String
        
        Set wb = Thisworkbook
        sPath = "C:\your path\"    'location of files
        ChDir sPath
        sFil = Dir("*.xlsx")    'change or add formats
        Do While sFil <> ""    'will start LOOP until all files in folder sPath have been looped through 
        Set oWbk = Workbooks.Open(sPath & "\" & sFil) 'opens the file
    
            ' do something
            oWbk.Close True    'close the workbook, saving changes
            sFil = Dir
        Loop    ' End of LOOP
    End Sub
    The do something would be something like

    Sheet1.Range("A1:E100").Copy
    wb.Activate
    Sheet1.Range("A" & Rows.Count).End(xlup).Cells(2,1).PasteSPecial(xlPasteValues)
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    10-12-2020
    Location
    Tel Aviv,Israel
    MS-Off Ver
    Office 365
    Posts
    2
    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    Here's the general approach I use.

    Sub Open_All_Files()
        Dim oWbk As Workbook, wb as Workbook
        Dim sFil As String
        Dim sPath As String
        
        Set wb = Thisworkbook
        sPath = "C:\your path\"    'location of files
        ChDir sPath
        sFil = Dir("*.xlsx")    'change or add formats
        Do While sFil <> ""    'will start LOOP until all files in folder sPath have been looped through 
        Set oWbk = Workbooks.Open(sPath & "\" & sFil) 'opens the file
    
            ' do something
            oWbk.Close True    'close the workbook, saving changes
            sFil = Dir
        Loop    ' End of LOOP
    End Sub
    The do something would be something like

    Sheet1.Range("A1:E100").Copy
    wb.Activate
    Sheet1.Range("A" & Rows.Count).End(xlup).Cells(2,1).PasteSPecial(xlPasteValues)
    Hi Richard. Thanks for the quick repaly. Unfortunatly I have no experiance in in scripting so I dont have a clue how to implement this...is there a way to thus with power query or any other microsoft tool? Seems like something very basic to me...

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Automatically combining multiple excels into one

    Quote Originally Posted by marmoor99 View Post
    Hi Richard. Thanks for the quick repaly. Unfortunatly I have no experiance in in scripting so I dont have a clue how to implement this...is there a way to thus with power query or any other microsoft tool? Seems like something very basic to me...
    There may be I'm not familar with exactly how, but it may involve some level of macro scripting to automate it.

    How many workbooks are you talking about? If you upload a couple of examples and summary workbook that contains what you want to see as a result I'll add the macro for you.

+ 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. Multiple Excels running with their own macros
    By wasky in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2019, 02:39 AM
  2. Multiple excels
    By Shradharani in forum Excel General
    Replies: 2
    Last Post: 03-09-2018, 08:54 AM
  3. [SOLVED] Creating multiple excels with one excel
    By Shradharani in forum Excel General
    Replies: 1
    Last Post: 02-05-2018, 05:43 AM
  4. [SOLVED] combining text of multiple cells in one automatically
    By dutchmaste in forum Excel General
    Replies: 5
    Last Post: 06-04-2015, 06:58 PM
  5. Replies: 1
    Last Post: 09-28-2013, 02:46 AM
  6. Combining multiple spreadsheets to automatically populate a new sheet
    By dlocos in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-30-2013, 10:16 PM
  7. Replies: 4
    Last Post: 09-30-2012, 07:15 AM

Tags for this Thread

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