How to open & Close Userform Automatically Using excel VBA

Home More Videos

Mike wants to know how to open a userform when he open 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:

Watch the video on youtube