As suggested by Arlette, you are using the 'Worksheets' object without any reference to which workbook the object relates to, hence Excel will by default use the workbook that has the focus on that specific moment in time.

you could use:

Thisworkbook.worksheets("Sheet3").Range("A17").value = "Test"
to ensure that Excel always looks for SHeet3 in the same workbook as where the code is running.