That will error on the unload userform1 line if the userform is unloaded by clicking on the corner x.

You may be looking for ActiveSheet.