Enter Data in an Excel UserForm
By ddalgleish
The Advantages of UserForms
To make it easier for users to enter data in a workbook, you can create
a UserForm. It requires some programming, and the steps are clearly shown in the following short videos.
In this example, inventory data is stored on a hidden worksheet. Users enter inventory data by opening the UserForm, filling in the boxes, and clicking a button.
Advantages to this method -- it's easy for users to enter the data, and the inventory data is protected from accidental deletion or editing.
Set Up the Inventory Worksheet
The data is stored in a table on a hidden worksheet. In this example, there are four columns of data stored: PartID, Location, Date and Quantity.
When the user clicks the Add this part button on the UserForm, the record will be added to the bottom of this list.
Create the UserForm
UserForms are created in the Visual Basic Editor. In Excel, to open the Visual Basic Editor, hold the Alt key, and tap the F11 key on your keyboard.
This is where you'll add a UserForm and enter the programming code.
To get started, you'll insert a UserForm, by clicking on the Insert menu, then clicking UserForm. This will create a blank UserForm for your workbook.
Add Textboxes to the UserForm
The objects on a UserForm, such as buttons, and boxes where users can type, are called controls.
To allow users to enter data, you can add textbox controls to the form, with label controls to describe what the textboxes are for.
In the Part 1 video, shown below, you can see the steps to create the UserForm, add a textbox, and add a label for that textbox.
Create a UserForm Video - Part 1
Add Buttons to the UserForm
To allow users to perform an action, you can add command buttons to the user form. This form has two buttons:
Add This Part - users will click this button to add inventory data to the database
Close Form - users will click this button to close the form, when they're finished entering data.
The following video shows how to add the buttons.
Create a UserForm Video - Part 2
Add Code to the Buttons
The next step is to add code, to make the buttons perform an action when
the button is clicked. The next video shows how to add the code.
Create a UserForm Video - Part 3
Create a Data Entry Sheet
The final step is to create a sheet with a button that users can click, to open the UserForm.
This button runs a macro that open the UserForm.
Sub Rectangle1_Click()
frmParts.Show
End Sub
To download a sample file that contains the UserForm and all the code, you can visit the Create a UserForm In Excel page on my website.
Understand the UserForm VBA Code
My Pivot Table Books
![]() | Amazon Price: $19.09 List Price: $34.99 |
![]() | Amazon Price: $22.37 List Price: $39.99 |
![]() | Amazon Price: $21.40 List Price: $34.99 |
More of My Excel Hubs
- Organize Data in an Excel 2007 Table
In Excel 2007, the formatted Excel Table feature makes it easier for you to sort and filter your data, and to scroll through thousands of rows. An Excel Table expands when you add new data, so it can be used as the source for a Pivot Table, and new data will automatically when you update the pivot table. - 2 years ago
- How to Fix Blank Cells Before Sorting in Excel
Blank cells could be putting your Excel data at risk! Some Excel worksheets have cells that were left blank, to make the headings and subheadings easier to read. For example, in the screen shot... - 2 years ago
- Holiday Dinner Planner in Excel
In Excel Dinner Planner, select a time to eat dinner, and enter the menu items. Excel will create a timetable, to help you stay organized, and have dinner ready on time. - 2 years ago
I don't have any examples of a calculator in an Excel UserForm. If you post your question in the Excel programming newsgroup, someone may be able to help. You can access the newsgroups through the Microsoft web site:
Why when i click run then appear Macros window? and what i must do with that?
@Syesar, I'm not sure -- do you have macros enabled in your workbook?
I am looking for someone to help me in creating a form that will allow users to enter the required information and this information should fill a standard notes. like when the user enters date in the data field it should show up in the appropriate place in the predefined text or notes format.
you may reach me at pep50in@yahoo.co.in thanks you.....
How to add textbox to a saved userform?
Hello, sorry i can't see much on you tube., can you try to share in vuclip... thank



anileadara 2 years ago
will you please help in calculator in excel userform