![]() ![]() ![]() Step 9: Double click on the ‘ Add (+) Button’ and add the below code. Step 8: Double click on the ‘ Minus (-) Button’ and add the below code. Step 7: Double click on the ‘ Multiplcation (*) Button’ and add the below code. Step 6: Double click on the ‘ Divide (/) Button’ and add the below code. If txtRes 0 And txtRes "" Then txtRes = Left(txtRes, Len(txtRes) - 1) Step 5: Double click on the ‘ Back Button ‘ and add the below code. Step 4: Double click on the ‘Clear Button’ and add the below code. Step 3: Set properties as mentioned above and do the alignment of all controls as shown above in the screenshot. In the above code we are displaying message when displaying numbers are exceeding 10. MsgBox "Its Too long to calculate value.", vbInformation Double click on the ‘ Textbox’ and add the below code. Step 2: Double click on the textbox (Value-txtRes) and add the following code. ![]() In the above code we are setting maximum lenth of display numbers is 10. Step 1: Create userform and do its initialization by double clicking on the userform and add the below code. By changing or setting all the above properties and values of control the form will be looking like below. This is what I used to create calculator design. Now, let us see the design of the calculator project of each control properties and their values on the userform: Step 22: Textbox: It is used to display result.Step 21: EqualTo (=) Button: It is used to perform all calculations like addition, substraction, multiplcation, etc.Step 20: Zero (0) Button: It is used to display number.Step 19: Nine (9) Button: It is used to display number 9.Step 18: Eight (8) Button: It is used to display number 8.Step 17: Seven (7) Button: It is used to display number 7.Step 16: six (6) Button: It is used to display number 6.Step 15: Five (5) Button: It is used to display number 5.Step 14: Four (4) Button: It is used to display number 4.Step 13: Three (3) Button: It is used to display number 3.Step 12: Two (2) Button: It is used to display number 2.Step 11: One (1) Button: It is used to display number 1.Step 10: Dot (.) Button : It is used to add dot to the number.Step 9: Add (+) Button: It is used for addition.Step 8: Minus (-) Button: It is used for subtraction.Step 7: Multiplcation (*) Button: It is used for multiplication.Step 6: Divide (/) Button: It is used for division.Step 5: Back Button : It is used to go back one digit.Step 4: Clear Button: It is used to clear the display area.Step 3: Set properties and alignment of all controls: Properties of each control has set.You can drag the controls from the toolbox and drop controls on the userform. Step 2: Place toolbox controls on the created userform: Place required controls on the userform.Step 1: Create UserForm: we have to first create the userform from the Insert menu in VBA Editor.We are going to write multiple procedure s for multiple controls with the below approach. Let me explain the key steps to develop this caculator project. To createc calculator, you can see the design of the userform in the section. How we are going to develop this project module (The KEY steps) : Download the Project Workbook – Excel Macro File.How we are going to develop this project module(The KEY steps). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |