Open Close Userform Automatically Using Excel VBA

Mike wants to know how to open a userform when he opens his Excel workbook and how to close the userform once the work is finished. We quickly design the userform using labels, textboxes and command buttons. Then we code the userform to open automatically and the appropriate button to close the userform once the data entry work is finished.
We have earlier learnt how to design and code such a userform.

The Excel VBA or macro code for opening the userform is given below:
Private Sub Workbook_Open()
End Sub

The macro code for the ‘close’ code is:

Private Sub CommandButton2_Click()
Unload Me
End Sub

Watch the Excel training video below to see how the complete process is implemented:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.