REAL-TIME

VBA Projects

Full Access with Source Code
  • Designed and Developed by PNRao

  • Full Access with VBA Source Code

  • Well Commented Codes Lines

  • Creative and Professional Design

Effortlessly
Manage Your Projects

120+ Project Management Templates

Seamlessly manage your projects with our powerful & multi-purpose templates for project management.

120+ PM Templates Includes:
  • 50+ Excel Templates

  • 50+ PowerPoint Templates

  • 25+ Word Templates

Share Post

Show or hide a userform means to display or hide a Userform. We use Show method of userform in a macro to display a userform. We use Hide method of userform or Unload statement in a macro to hide a userform. Please find the below example for better understand how to show or hide a userform on the worksheet.

Show a UserForm

Please find the following instructions and example to Show a UserForm on the Worksheet.

  1. place a command button on your worksheet.
  2. Double click on the command button.
  3. Now, you can see the following procedure. Please find the following screenshot.
  4. Excel UserForm show hide unload

    Private Sub CommandButton1_Click()
    
    End Sub
    
  5. Add the following code to the above procedure. Shown in the following.
  6. Private Sub CommandButton1_Click()
        UserForm1.Show
    End Sub
    
  7. Now, go to worksheet and click on the Command button to see the UserForm on the screen.

Show a UserForm while opening Excel File or Workbook

Here is the example code to Show a UserForm while opening Excel File or Workbook. Please find the below instructions.

  1. Go to Visual Basic Editor or Press Alt+F11
  2. In the Project Explorer,You can find The Workbook module.
  3. Select Workbook from the object drop down list(find left side)
  4. Select open from the procedure or event drop down list (find right side). Please find the following screenshot for the same.
  5. Excel UserForm show hide unload

  6. You can see Workbook Open procedure . Its is shown as follows.
  7. Private Sub Workbook_Open()
    
    End Sub
    
  8. Now, you can add the following code to the above event. It is shown in the following line.
  9. Private Sub Workbook_Open()
        UserForm1.Show
    End Sub
    

Hide a UserForm

When we hide the userform, it will just hide the userform and will not release the objects and variables from the memory. Where as Unload method will release the objects and variables from the memory.
Please find the following instructions and example to Hide a UserForm on the Worksheet.

  1. place a command button on your worksheet.
  2. Double click on the command button.
  3. Now, you can see the following procedure.
  4. Private Sub CommandButton1_Click()
    
    End Sub
    
  5. Add the following code to the above procedure. Shown in the following.
  6. Using Hide Method:

    Private Sub CommandButton1_Click()
        UserForm1. Hide
    End Sub
    

    Using Unload Method:

    Private Sub UserForm_Click()
        Unload Me
    End Sub
    

    When we click on the Userform, it will disappear from the screen.

  7. Now, go to worksheet and click on the Command button to hide or unload a UserForm on the screen.
  8. So, Hide method will be used when we want to hide the form temorarly and to show after sometime to the user. Where as unload will be used when it completes the task.
Effortlessly Manage Your Projects and Resources
120+ Professional Project Management Templates!

A Powerful & Multi-purpose Templates for project management. Now seamlessly manage your projects, tasks, meetings, presentations, teams, customers, stakeholders and time. This page describes all the amazing new features and options that come with our premium templates.

Save Up to 85% LIMITED TIME OFFER
Project Management Templates

All-in-One Pack
120+ Project Management Templates

Essential Pack
50+ PM Templates

Excel Pack
50+ Excel PM Templates

PowerPoint Pack
50+ Excel PM Templates

MS Word Pack
25+ Word PM Templates

Ultimate Project
Management Template
Ultimate Resource
Management Template
Project Portfolio
Management Templates
Categories: Excel VBA, VBATags: , , , , , , , Last Updated: June 17, 2022

One Comment

  1. Venkat July 4, 2016 at 6:23 PM

    Dear Mr.P.N Rao !
    Is it possible to use enter key on a commandbutton on an excel sheet instead of click() ? if so how ? I am a regular visitor of your site and blog..

    Regards

Leave A Comment