Option Base 1
Sub GetValues()
Dim path As String
Dim fileNames As Range
Dim missingFile As String
If Range("C1").Value = "" Then
MsgBox ("Please fill in the file path")
Exit Sub
Else
GetFileNames
With wsControlPanel
path = CheckPath(.Range("Path"))
Set fileNames = .Range("FileNames")
missingFile = checkMissingFiles(path, fileNames)
If missingFile <> "" Then
MsgBox missingFile & " is missing in " & path
Exit Sub
End If
OpenWorkbook path, fileNames
End With
'Application.Calculation = xlCalculationAutomatic
'ActiveWorkbook.Save
End If
End Sub
Sub OpenWorkbook(path As String, fileNames As Range)
With ActiveSheet
For n = (Z + 1) To fileNames.Count
If fileNames(n, 1) <> "" Then
Workbooks.Open path & fileNames(n, 1), False, True
'My code
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Windows("Template_File open.v5.1.xlsm").Activate
Sheets("INPUT").Select
Range("A1").Select
ActiveSheet.Paste
ActiveWindow.ActivateNext
Application.CutCopyMode = False
ActiveWorkbook.Saved = True
ActiveWorkbook.Close SaveChanges:=False
Call IMPORT_DATA
End If
Next n
End With