PDA

View Full Version : Solved: unload userform before worksheet deactivate



av8tordude
07-09-2009, 09:28 PM
I have a userform that I would like to be unloaded before selecting a different worksheet. I know I can just close the userform, but as a backup to forgeting to close the userform, I would like the userform to close automatically. Any suggestions? Thanks.

anandbohra
07-09-2009, 10:22 PM
by the way when u show a userform how can a user select different worksheet?
he has to compulsorily close userform for returning to excel


of something else in your mind type this code in this workbook code

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
unload UserForm1
End Sub

mdmackillop
07-09-2009, 11:41 PM
Anandbohra
If the Userform is opened non-modally, the user can use the spreadsheets etc. as normal. This is done using

Userform1.Show False

anandbohra
07-10-2009, 12:07 AM
Anandbohra
If the Userform is opened non-modally, the user can use the spreadsheets etc. as normal. This is done using

Userform1.Show False


Thanks mdmackillop :friends:
It something new for me :bow:

btw av8tordude I hope your query is solved as my code unload non-modally opened user form on sheet change

av8tordude
07-10-2009, 03:50 AM
Thank you both :friends: