By changing or setting all the above properties and values of control the form will be looking like below. Declaring variables which are using in the entire project.
Disable Screen Updating is used to stop screen flickering and Disable Events is used to avoid interrupted dialog boxes or popups. Create userform by adding controls to the userform from the Toobox. In this project we are placing seven Labels, two Radio buttons, six Textboxes and three CommandButtons. You can refer the design section of the Data entry userform to create userform. Create Procedure for field validation. We have to validate the data before updating into our Data Worksheet.
So, we need to gather the correct format of data from the user. Create function to find lastrow. Here is the function code to find last row in the Data Worksheet. Or You can use this function to find last row of any specified sheet by passing sheet name as argument to the function. Create procedure to clear fields of userform Here is the code to clear the Userform fields. It is helpful when we want to update more than one record to the worksheet.
Once you add record to the worksheet and then clear data fields to enter new data to on the UserForm. Cretae procedure to update data to the Worksheet.
Here is the code to add or update data to the Worksheet. Create procedure to unload userform. Here is the code to exit from the userform. Or you can click on top right corner of the userofrm. Please find the following procedures to create Data Entry UserForm project. Double click on the Userform FrmData and add the following code to it. Insert module from the insert menu and add the following code to it. Place any shape by clicking on insert menu from illustrations group. Right click on the shape, selct assign macro.
Now, go to the Developer tab. Design Mode should be turned off from the Controls group. Now, go back to the shape and click on the created shape to see the Data Entry UserForm on the Worksheet in the active Workbook. Instructions to Execute the Procedure: You can download the below file and see the code and execute it. Or else, you create new workbook and use the above code and test it. Here are the instructions to use above code. Insert a new module from the Insert menu. Copy the above procedure and paste it in the newly created module.
Final Outcome of the project: Here is the sample screen shot of the entire project output for your reference. Here is the Data Entry UserForm project workbook macro file to explore yourself.