|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Need help fixing compile error expected End Sub to combine multiple documents into one (Mac)
I would like to combine multiple excel files into one. I was referred to trumpexcel.com. I entered the following and get a compile error: expected End Sub. How do I fix it? Is trumpexcel legit? If not what is the right verbiage to use?
Code:
Sub ConslidateWorkbooks() 'Created by Sumit Bansal from https://trumpexcel.com Dim FolderPath As String Dim Filename As String Dim Sheet As Worksheet Application.ScreenUpdating = False FolderPath = Environ("userprofile") & "\Desktop\files to merge\" Filename = Dir(FolderPath & "*.xls*") Do While Filename <> "" Workbooks.Open Filename:=FolderPath & Filename, ReadOnly:=True For Each Sheet In ActiveWorkbook.Sheets Sheet.Copy After:=ThisWorkbook.Sheets(1) Next Sheet Workbooks(Filename).Close Filename = Dir() Loop Application.ScreenUpdating = True End Sub Last edited by Pecoflyer; 10-24-2018 at 11:19 PM. Reason: Added code tags & repaired formatting (macropod) + added Mac to title |
#2
|
||||
|
||||
Your user profile indicates you're using a Mac; the code you posted is for Windows and will not work on Macs.
PS: When posting code, please format your code and use the code tags, indicated by the # button on the posting menu. Without them, your code loses much of whatever structure it had.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thank you Paul. I know absolutely nothing about code. What would be the right one to use on Macs to consolidate several excel files into one?
|
#4
|
||||
|
||||
Ron de Bruin has an add-in for doing this on the Mac here: http://www.rondebruin.nl/mac/addins/mergemac.htm
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
compile error expected end sub | ashg75 | Word VBA | 2 | 07-13-2017 07:08 AM |
best approach to combine documents being created by multiple users | jwalke123 | Word | 5 | 08-08-2015 03:27 PM |
Compile error in Module | ksigcajun | Word VBA | 2 | 04-08-2015 06:44 AM |
Cross-referencing in multiple documents that will combine to make one report | razberri | Word | 1 | 01-20-2014 01:00 AM |
combine multiple documents word starter 2010 | bribelge | Word | 3 | 12-19-2012 09:25 AM |