I have 19 files with different data sets in each file. Each file has one worksheet with 2 columns, i am trying to write a VB Macro assigned to a button [Get Output Data] - name of my button in one worksheet.
This is the code i have written to get data from one of the 19 files.
Sub FetchQAData()
Dim filePath As String
Dim SourceWb As Workbook
Dim TargetWb As Workbook
Set TargetWb = ActiveWorkbook
filePath = TargetWb.Sheets("Control").Range("D8").Value
Set SourceWb = Workbooks.Open(filePath)
SourceWb.Sheets("results").Range("A1:B9").Copy Destination:=TargetWb.Sheets("QA model output").Range("B5:C13")
SourceWb.Close
MsgBox "RESULTS IMPORTED"
End Sub
The files are all stored on a central server and when i run the Macro get a Run-time error 1004 and the application doesn't recognize the file path.
Can anyone help here please?