Microsoft Office Forums Need help fixing compile error expected End Sub to combine multiple documents into one (Mac)

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-23-2018, 11:28 AM
Vivianweir Vivianweir is offline Need help fixing compile error expected End Sub to combine multiple documents into one (Mac) Mac OS X Need help fixing compile error expected End Sub to combine multiple documents into one (Mac) Office 2011 for Mac
Novice
Need help fixing compile error expected End Sub to combine multiple documents into one (Mac)
 
Join Date: Oct 2018
Posts: 2
Vivianweir is on a distinguished road
Exclamation 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
Thank you!!!

Last edited by Pecoflyer; 10-24-2018 at 11:19 PM. Reason: Added code tags & repaired formatting (macropod) + added Mac to title
Reply With Quote
  #2  
Old 10-23-2018, 04:47 PM
macropod's Avatar
macropod macropod is offline Need help fixing compile error expected End Sub to combine multiple documents into one (Mac) Windows 7 64bit Need help fixing compile error expected End Sub to combine multiple documents into one (Mac) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,599
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

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
[MS MVP - Word]
Reply With Quote
  #3  
Old 10-24-2018, 02:10 PM
Vivianweir Vivianweir is offline Need help fixing compile error expected End Sub to combine multiple documents into one (Mac) Mac OS X Need help fixing compile error expected End Sub to combine multiple documents into one (Mac) Office 2011 for Mac
Novice
Need help fixing compile error expected End Sub to combine multiple documents into one (Mac)
 
Join Date: Oct 2018
Posts: 2
Vivianweir is on a distinguished road
Default

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?
Reply With Quote
  #4  
Old 11-02-2018, 02:20 AM
Debaser's Avatar
Debaser Debaser is offline Need help fixing compile error expected End Sub to combine multiple documents into one (Mac) Windows 7 64bit Need help fixing compile error expected End Sub to combine multiple documents into one (Mac) Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Posts: 166
Debaser is on a distinguished road
Default

Ron de Bruin has an add-in for doing this on the Mac here: http://www.rondebruin.nl/mac/addins/mergemac.htm
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
compile error expected end sub ashg75 Word VBA 2 07-13-2017 07:08 AM
Need help fixing compile error expected End Sub to combine multiple documents into one (Mac) best approach to combine documents being created by multiple users jwalke123 Word 5 08-08-2015 03:27 PM
Need help fixing compile error expected End Sub to combine multiple documents into one (Mac) 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


All times are GMT -7. The time now is 02:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft