Be the first user to complete this post
|Add to List|
VBA-Excel: User Forms
User Forms are one of the very important features in Excel Macro. It provides and an interface to the user for interaction with the workbook. It has many controls which makes user’s life easy for entering the data from excel in a specific manner or reading the particular data from the excel.
Getting Started : Create a Blank User Form
- To open or create a new user form, follow the steps below
- Open an Excel file
- Press “Alt+F11” to open the Microsoft Visual Basic Editor.
- Make Project Explorer and Property Window visible from “view menu” (If not already visible)
- Select the Project from the Project Explorer.
- Form “Insert” menu, select “User Form”
- Select the Userform1
- Go to the Property Window,
- Change the Name Property to “FirstForm”
- Change the Caption Property to “My First User Form”
16. Add Controls to the User form
- Select the control from the Tool Box and place it in the User Form.( here Command Button is selected)
- Select or Single Click on the Command Button from the Tool Box.
- Now Click on the UserForm, a new CommandButton will be created.
Private Sub FirstButton_Click()
MsgBox "Yeaaaahhhhh , I got Clicked"
NOTE : To Navigate Between “Code Window” and “UserForm Design Window” KeyBorad Shortcut is [Control]+[Tab]
17. Now your User Form is ready to run. All you have to do is assign this User Form to a macro.
Macro to Open the UserForm
- Select the VBA Project from Project Explorer
- Form “Insert” menu, select “Module”
- VBA-Excel: Create or Add Worksheets at the Run time.
- Excel-VBA : Prevent Adding New Worksheet
- VBA-Excel: WorkBook.Save Method
- VBA-Excel: CurrentRegion
- Excel-VBA : Prevent Changing the WorkSheet Name
- VBA-Excel: Delete Blank Rows from Excel Work Sheet
- Add Tools to Quick Access Tool Bar(Excel Top Bar)
- VBA-Excel: Select and Activate Cells - Select