I've got a master spreadsheet that I want to populate with various data sets from team members. I've done this before and it worked well, but also conscious that at some point I will get that infamous runtime error (-2147319767 (80028029)).
In the past a colleague told me that the way to avoid it was to declare the files and sheets as variables DIM, SET, etc.
I can never quite get my head around these so could someone help me with my code please:
The code is just opening the file, unhiding a sheet, copying the data and pasting it into the main report:
Workbooks.Open Filename:="S:\International\Interview Scoresheet (Justin).xlsm""
Sheets("Scores").Visible = True
Sheets("Scores").Select
Windows("Interview Scoresheet (Justin).xlsm").Activate
Sheets("Scores").Select
Range("A2:Z" & Range("A" & Rows.Count).End(xlUp).Row).Select
Selection.Copy
Windows("Interview Checks.xlsm").Activate
Sheets("Scores").Select
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows("Interview Scoresheet (Justin).xlsm").Activate
ActiveWindow.Close savechanges:=False
Workbooks.Open Filename:="S:\International\Interview Scoresheet (Soyuncu).xlsm""
Sheets("Scores").Visible = True
Sheets("Scores").Select
Windows("Interview Scoresheet (Soyuncu).xlsm").Activate
Sheets("Scores").Select
Range("A2:Z" & Range("A" & Rows.Count).End(xlUp).Row).Select
Selection.Copy
Windows("Interview Checks.xlsm").Activate
Sheets("Scores").Select
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows("Interview Scoresheet (Soyuncu).xlsm").Activate
ActiveWindow.Close savechanges:=False