
Originally Posted by
Norie
What happens when WSMerge is called?
Is it ever called?
You can check that by putting a breakpoint (F9) on the line that calls it and then running Macro1.
If the code is't interrupted at the point it means that line is never reached, which could mean that there is something in WBMerge stopping code execution.
Norie,
WSMerge doesn't appear to be getting called.
Here is the WBMerge macro, see anything that would be causing this?
Thanks!
Sub WBMerge()
Dim sFolder As String
Dim sFile As String
Dim wbD As Workbook, wbS As Workbook
Application.ScreenUpdating = False
Set wbS = ThisWorkbook
sFolder = wbS.Path & "\"
wbS.Sheets("sheet1").UsedRange.Offset(1).Clear
sFile = Dir(sFolder)
Do While sFile <> ""
If sFile <> wbS.Name Then
Set wbD = Workbooks.Open(sFolder & sFile) 'open the file; add condition to
wbD.Sheets("Deficiencies").UsedRange.Offset(1, 1).Copy
wbS.Activate
Sheets("sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
wbS.Sheets("sheet1").Columns.AutoFit
Application.CutCopyMode = False
wbD.Close savechanges:=False 'close without saving
End If
sFile = Dir 'next file
Loop
Application.ScreenUpdating = True
Workbooks("workbook1.xlsm").Close
Workbooks("workbook1.xlsm").Close
End Sub
Bookmarks