Excel training videos

Userform in Excel 2007

Creating a custom dialog box

Click on developer tab of the Microsoft Office ribbon, select Visual Basic and click on insert and then select 'user form'. On the form you can place controls like labels, text boxes, command buttons, etc. We have placed 4 labels with captions called 'Name', 'Salary', 'Perks' and 'Package' . These labels help the user to enter the relevant details in the neighboring text boxes. The text boxes can only accept text i. e. if you enter a number like '6000' it has to be converted into a 'value' or number by using the 'val' command. We have also placed a command button whose caption is 'calculate'. The command button control reacts to an event like the click of a muse button and also executes the code that is assigned to it. In our example in the training video, we have coded the command button to convert the numbers input into the text boxes into numbers and then perform an addition to display the final package that the employee receives every month. We have, in fact, created a custom form where you can input data and the calculation is performed on clicking the command button. More sophisticated calculations can be performed and applications created by coding the command button approprately to accept more parameters through more text boxes.


User form in Excel 2007