Sorry, I have very little VBA skills...
I have a macro that is mostly working, but it is extremely slow and it stalls after completing the Do-While loop... I can't figure out why! Also, this macro calls another subroutine. On its own, the other subroutine is fast, but when it gets called it's very slow.
Any ideas?
Here is my code:
Sub Consolidate_To_One_Workbook()
Dim folderPath As String
Dim filename As String
Dim wb As Workbook
folderPath = "C:\Stuff\Macrofiles\" '
If Right(folderPath, 1) <> "\" Then folderPath = folderPath + "\"
Set OutputBook = Workbooks.Add
With OutputBook
.SaveAs filename:="C:\Stuff\Macrofiles\Output.xls"
End With
filename = Dir(folderPath & "*.xls")
Do While filename <> ""
Application.ScreenUpdating = False
Set wb = Workbooks.Open(folderPath & filename)
'Calls my subroutine here to operate on the just-opened workbook
Call DataGrabber
wb.Close False
filename = Dir
Loop
Application.ScreenUpdating = True
Workbooks("Output.xls").Worksheets("Sheet1").Activate
Columns("A:ZZ").EntireColumn.AutoFit
End Sub
Thanks in advance for your help!
Bookmarks