This error occurs when the userform has been unloaded before the rest of the code can complete. My guess is that you clicked the cross in the top right of the userform to close the form. To overcome this add the following to the userform code
Code:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
CommandButtonCancel_Click
Cancel = True
End If
lbl_Exit:
Exit Sub
End Sub