+ Reply to Thread
Results 1 to 3 of 3

merge multiple excel files into one sheet vba

  1. #1
    Registered User
    Join Date
    07-02-2019
    Location
    USA
    MS-Off Ver
    2019
    Posts
    19

    merge multiple excel files into one sheet vba

    I am stuck and do not know what I am doing wrong. I am trying to merge .xlsx files on daily basis. I have a folder on my desktop called mergeFiles within it there are 3 testfile: test1.xlsx, test2.xlsx and test3.xlsx I usually have around 100 files or more.

    [CODE] Sub GetSheets() [CODE]
    [CODE] Path = “HD:Users:spudn56:Desktop:mergeFiles.xlsm" [CODE]
    [CODE] Filename = Dir(Path & "*.xls") [CODE]
    [CODE] Do While Filename <> "" [CODE]
    [CODE] Workbooks.Open Filename:=Path & Filename, ReadOnly:=True [CODE]
    [CODE] For Each Sheet In ActiveWorkbook.Sheets [CODE]
    [CODE] Sheet.Copy After:=ThisWorkbook.Sheets(1) [CODE]
    [CODE] Next Sheet [CODE]
    [CODE] Workbooks(Filename).Close [CODE]
    [CODE] Filename = Dir() [CODE]
    [CODE] Loop [CODE]
    [CODE] End Sub [CODE]

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Exclamation Re: merge multiple excel files into one sheet vba


    Use the icon for the code tags …

    And just use the appropriate file extension in your code as .xls is not .xlsx ‼

  3. #3
    Registered User
    Join Date
    07-02-2019
    Location
    USA
    MS-Off Ver
    2019
    Posts
    19

    Re: merge multiple excel files into one sheet vba

    I corrected the files to .xls but code still didn't work.

+ 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. Merge Multiple Excel Files into one sheet
    By dtgheath in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2018, 10:42 AM
  2. Merge multiple excel files into one sheet.
    By Aryan4567 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-20-2017, 02:42 PM
  3. how to merge multiple excel files!!!
    By buddigars in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-15-2014, 05:38 PM
  4. [SOLVED] Merge multiple excel files
    By starlight1987 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2014, 05:24 AM
  5. Merge multiple Excel files into one
    By Luma in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-04-2014, 08:59 AM
  6. How to merge multiple excel files..?
    By clone000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2010, 05:51 PM
  7. How to merge multiple Excel Files into One File
    By janeshh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2009, 08:09 AM

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