I have a macro to open up a bunch of files, copy data into another workbook and close the files again. Everything works fine except for each file when it's closing the message asking if I want to save it keep coming up even though within the macro I have set the displace alert to False. Not sure what I'm doing wrong? Thanks.
Sub Open_Files()
Dim MyFile As String
MyPath = Range("_location").Value
MyFile = Dir(MyPath)
Set wb1 = ActiveWorkbook
Application.DisplayAlerts = False
Do While MyFile <> ""
If MyFile Like "*.xlsx" Then
Workbooks.Open MyPath & MyFile
Sheets("Cost Forecast").Rows("3:250").Copy
wb1.Sheets("Consolidated Cost Forecast").Cells(Rows.Count, 1).End(xlUp).Offset(1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
ActiveWorkbook.Close savechanges:=False
End If
MyFile = Dir
Loop
Application.DisplayAlerts = True
MsgBox "Forecasts consolidated.", vbInformation
End Sub