I\'m trying to copy two cells B2 & C2
from the Results
worksheet on every single workbook within a folder and then paste cells in a Master workboo
Workbooks.Open
is a function, that returns a reference to the Workbook
object that was opened - and you're discarding it.
Declare a Workbook
variable.
Dim wb As Workbook
Then assign it to the result of the Workbooks.Open
call:
Set wb = Workbooks.Open(Filepath & MyFile)
Now wb
is the workbook object you work with - whether it's active or not, doesn't matter anymore.
wb.Worksheets("Results").Range("B2:C2").Copy
'NOTE: paste to destination BEFORE closing the workbook
wb.Close SaveChanges:=False