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
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...
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...
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?!...
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...
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:...
We had a question today regarding how to increase or decrease the date field in this Excel VBA user form. The first thing we had to do was create a user form and insert a Text Box. When we double-click on this text box, the default event is the change...