|
|
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 |
|
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 |