I have code below that I need amended to limit selection to .xlsm files that contain EVT and must be latest modified files
The code works well, except does not limit the brosing to files containing EVT, being the latest modified files
Kindly amend my code
The code works well, except does not limit the brosing to files containing EVT, being the latest modified files
Kindly amend my code
Code:
Sub Open_Workbook()
ChDir ("C:\SalesReport by Month")
A:
Dim A As Variant
Dim LR As Long
A = Application.GetOpenFilename(MultiSelect:=True)
If TypeName(A) = "Boolean" Then Exit Sub
Dim file As Variant
Application.ScreenUpdating = False
For Each file In A
With Workbooks.Open(file)
With Sheets(2)
.Range("a1", .Range("X" & Rows.Count).End(xlUp)).Copy _
Destination:=ThisWorkbook.Sheets("Imported Data").Range("A" & Rows.Count).End(xlUp).Offset(1)
End With
.Close SaveChanges:=False
End With
Next
With Sheets(2)
.Range("A1").EntireRow.Delete
End With
Application.ScreenUpdating = True
End Sub