Hi there,

It's difficult to be certain without access to all of your code, but I suspect that the dreaded "not-fully-qualified reference" strikes again!

In the problem line:


daily_run = Worksheets("inputs").Range("daily_run").Value
the code will look for a worksheet called "inputs" in whichever workbook happens to be active when the line is executed, and will generate that error message if it is unable to find such a worksheet.


To avoid situations like this you should always use fully-qualified references, e.g:


daily_run = ThisWorkbook.Worksheets("inputs").Range("daily_run").Value
or

daily_run = Workbooks("Weekly Data").Worksheets("inputs").Range("daily_run").Value

Hope this helps - please let me know how you get on.

Regards,

Greg M