Hi everyone and thanks in advance for your time.
I am not a huge specialist in vba but sometimes it helps me to gain some good times on repetitive tasks I am working on.
I would like to gathered information from various files to one "recap" file. I named some ranges (one cell each) to ease the lookup for the these informations in all the files.
Here are the lines I began to write:
Sub collectdata()
Set a = Workbooks.Open("C:\full address\Project1.xlsx")
Set b = Workbooks.Open("C:\full address\Project2.xlsx")
Set c = Workbooks.Open("C:\full address\Project3.xlsx")
ThisWorkbook.Sheets("Data").Range("C3") = a.Application.Range("Project1_Total")
ThisWorkbook.Sheets("Data").Range("C3") = b.Application.Range("Project2_Total")
ThisWorkbook.Sheets("Data").Range("C3") = c.Application.Range("Project3_Total")
a.Close savechanges:=False
b.Close savechanges:=False
c.Close savechanges:=False
End Sub
I am stuck with error 1004. I think I know why but I don't know how to correct that.
With one "project" everything everything is okay.
But once I add a second file I get Error 1004.
With one named range from one project it is okay. But once I add a second named range from the same file I get Error 1004.
Thanks for your time.