Is there a fast easy way to merge 300 small spreadsheets into 1? They are formatted the same with only four columns. Three of them are attached. Thanks. Joe
Is there a fast easy way to merge 300 small spreadsheets into 1? They are formatted the same with only four columns. Three of them are attached. Thanks. Joe
Do you have experience with Visual Basic for Application (VBA)? The easiest way probably would be write a macro to loop each single file.
Thank you JieJenn - I don't know how to do that, though.
-Joe
Last edited by joebird; 05-10-2012 at 01:16 PM. Reason: sp
Hello there,
Do you want them to appear on one worksheet or on 300 individual worksheets?
Thanks,
RVASQUEZ
One worksheet. There are 300 that I want to merge into one, four-column worksheet. Thanks. (Excel 2003 by the way)
Create a workbook and named it Master Table. Press ALT + F11 to open the VBA window, right click ThisWorkbook, Insert, Module, and copy and paste the code.
Move all the files within the same folder. Under View ribbon, click Macro and click LoopFiles and click run. You might need to manually enter the header as I am at work, so I am trying to do as minimum as possible. But I just tested the macro, it loops all the file data into one master worksheet for me. Oh, you also need to change the directory address.
![]()
Sub LoopFiles() Const strFldrPath As String = "C:\Users\jjenn\Desktop\Loop\" Dim InputFile As String InputFile = Dir(strFldrPath & "*.xls") Do While InputFile <> vbNullString And InputFile <> "Master Table.xls" With Workbooks.Open(strFldrPath & InputFile) ActiveSheet.Range("A2:D" & Cells(Rows.Count, 1).End(xlUp).Row).Copy Workbooks("Master Table.xls").Activate Cells(Cells(Rows.Count, 1).End(xlUp).Row + 1, 1).Select ActiveSheet.Paste Application.DisplayAlerts = False If Workbooks(InputFile).Name <> "Master Table.xls" Then Workbooks(InputFile).Close Application.DisplayAlerts = True End With InputFile = Dir Loop End Sub
Got it! Thanks. I'll give it a shot.
Let me know if it works.
It works!!! Thank you ever so much. (It was 382 files).
-Joe
Cool. Now I get to brag about during the team meeting today haha...
I guess it worked?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks