I have a Macro that pulls a particular sheet from all workbooks in a directory and copies it into one workbook (the code is actually in the workbook, it is not in my personal workbook). It then renames these sheets based upon data from the sheet copied. I have been using this macro for several months, and it has worked fine until today. I cannot get the macro to run. I hit the run button, and nothing happens. No error messages, no nothing. I have attempted rerunning it in an existing workbook, copying an existing workbook, and copying the code and pasting into a mew module in a new workbook. All have the same result. I used this marco just yesterday with no issues. The source data location has not changed, nor has the location of the sheet containing the Macro. Any Ideas? Any help would be appreciated.
Code:
Option Explicit
Sub PullSheets()
Dim sFolder As String
Dim sFile As String
Dim wbSource As Workbook
Dim wbMaster As Workbook
Dim ws As Worksheet
Dim strShName As String
'====================================================
'EDIT THIS
sFolder = "C:\Users\Username\Documents\Annual Budget\ASPAC Submissions\" 'remember trailing backslash"
'====================================================
'set up the master workbook
Set wbMaster = ThisWorkbook
On Error GoTo errHandler 'reset application setting on error
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'loop through all excel files in folder
sFile = Dir(sFolder & "*.xls*")
Do Until sFile = ""
'open the source workbook
If sFile <> wbMaster.Name Then 'don't process the master workbook
Set wbSource = Workbooks.Open(sFolder & sFile)
'copy the first worksheet EDIT IF NECESSARY
wbSource.Worksheets(9).Copy After:=wbMaster.Sheets(wbMaster.Sheets.Count)
strShName = Mid(Range("C6").Formula, InStr(Range("C6").Formula, "[") + 1)
strShName = Split(strShName, "-")(0) & "-" & Split(strShName, "-")(1)
ActiveSheet.Name = strShName
wbSource.Close SaveChanges:=False
Application.CutCopyMode = False
End If
'get the next file
sFile = Dir()
Loop
For Each ws In Worksheets
Next
'tidy up
Set wbSource = Nothing
Set wbMaster = Nothing
errHandler:
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub