UserForm Basics #1
Here, you’ll learn to make a UserForm, add a button, and make clicking on that button hide the UserForm!
Make a UserForm:
- Press Alt-F11 to bring up Visual Basics menu
- Click the drop down menu in the upper left hand and select UserForm:
- Press F4 to bring up the properties menu. Use this box to change the userform’s name:
- Next, use the “Caption” field to change the UserForm’s caption:
Add a Button:
- Using the Toolbox Controls, add a Command Button:
- In the UserForm area, single click to create a standard size button, or click and drag to create the button size you want:
- Click on the button’s text to edit it’s display text:
- Using the properties menu on the left, you can change the button’s color, font, and other properties!
Hiding the UserForm when the button’s pressed!
- Double-click on your Command Button (or whatever you’ve named it in the properties menu), to bring up the event script menu.
- Use the command “.Hide” as shown in the picture below. In this example, the UserForm’s name was HideForm, thus the script line is “HideForm.Hide”:
- [snippet id=”50″]
Check out the video below for more details!
[frontpage_news widget=”14410″ name=”You Might Also Like”]
You Might Also Like
Your Excel CommandButtons Are Probably Terrible (Top 4 Controls Compared)
Buttons in ExcelWhen you buy something using the retail links in our pages, we may earn a small commission. ExcelVbaIsFun does not accept money for editorial product or software reviews. Read more about our policy. One of the most common things in applications is the...
Extra Sheets In Excel VBA – Corrupt Excel Workbook Help
If you've ever encountered a corrupt Excel workbook, you've probably tried lots of things already, including possibly tearing your hair out. In this particular scenario, we have lots of extra sheets that show up in the Visual Basic Editor. This is not great. ...and it...
Create Sheets For Each User From Column A
Sometimes in Excel, we need to automate simple tasks, like to create sheets automatically for each item in a range. If you just had a few worksheet tabs that needed to be created, it wouldn't be a big deal, but what if you had to create 100 different worksheet tabs?!...
How To Add A Date Picker Calendar in Excel VBA
Date Picker Calendar in Excel VBA Oftentimes, users want to click a button and select a date. This is no different for Excel developers. Check out this ActiveX control by Microsoft that allows users to do just that. It's a little old school looking, but actually has...
Student Saves 5+ Hours With Excel VBA Web Automation Course?
Check out how Jiyaad is able to save 5+ hours biweekly! He's using the Complete Web Automation with Excel VBA and Selenium course, jam packed with 8+ hours of videos.Want to see Free Previews? Click here.Get Lifetime Access to the course by using coupon code 'EVBAJYD'...
Highlight Userform Textbox in Excel VBA, Highlight All Text On Mouse Click, Button or Userform Open
In order to highlight text in a TextBox (other than Tabbing into that field), you can insert a couple helpful snippets of VBA code that will help you accomplish this easily! The first line tells VBA to put the cursor at the leftmost (0) character:...