6. 0 BUTTON
• Private Sub cmdBtn0_Click()
• txtRes = txtRes + cmdBtn0.Caption
• End Sub
7. . BUTTON
• Private Sub cmdBtnDot_Click()
• If txtRes <> 0 Then txtRes = txtRes + "."
• End Sub
8. 1 BUTTON
• Private Sub cmdBtn1_Click()
• If txtRes = 0 Then
• txtRes = cmdBtn1.Caption
• Else
• txtRes = txtRes + cmdBtn1.Caption
• End If
• End Sub
9. 2 BUTTON
• Private Sub cmdBtn2_Click()
• If txtRes = 0 Then
• txtRes = cmdBtn2.Caption
• Else
• txtRes = txtRes + cmdBtn2.Caption
• End If
• End Sub
10. 3 BUTTON
• Private Sub cmdBtn3_Click()
• If txtRes = 0 Then
• txtRes = cmdBtn3.Caption
• Else
• txtRes = txtRes + cmdBtn3.Caption
• End If
• End Sub
11. 4 BUTTON
• Private Sub cmdBtn4_Click()
• If txtRes = 0 Then
• txtRes = cmdBtn4.Caption
• Else
• txtRes = txtRes + cmdBtn4.Caption
• End If
• End Sub
12. 5 BUTTON
• Private Sub cmdBtn5_Click()
• If txtRes = 0 Then
• txtRes = cmdBtn5.Caption
• Else
• txtRes = txtRes + cmdBtn5.Caption
• End If
• End Sub
13. 6 BUTTON
• Private Sub cmdBtn6_Click()
• If txtRes = 0 Then
• txtRes = cmdBtn6.Caption
• Else
• txtRes = txtRes + cmdBtn6.Caption
• End If
• End Sub
14. 7 BUTTON
• Private Sub cmdBtn7_Click()
• If txtRes = 0 Then
• txtRes = cmdBtn7.Caption
• Else
• txtRes = txtRes + cmdBtn7.Caption
• End If
• End Sub
15. 8 BUTTON
• Private Sub cmdBtn8_Click()
• If txtRes = 0 Then
• txtRes = cmdBtn8.Caption
• Else
• txtRes = txtRes + cmdBtn8.Caption
• End If
• End Sub
16. 9 BUTTON
• Private Sub cmdBtn9_Click()
• If txtRes = 0 Then
• txtRes = cmdBtn9.Caption
• Else
• txtRes = txtRes + cmdBtn9.Caption
• End If
• End Sub
17. DIVISION BUTTON
• Private Sub cmdBtnDvd_Click()
• If txtRes = 0 Then
• txtRes = cmdBtnDvd.Caption
• Else
• txtRes = txtRes + cmdBtnDvd.Caption
• End If
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Divide"
• End If
• End Sub
18. MULTIPLICATION BUTTON
• Private Sub cmdBtnMult_Click()
• If txtRes = 0 Then
• txtRes = cmdBtnMult.Caption
• Else
• txtRes = txtRes + cmdBtnMult.Caption
• End If
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Multiplication"
• End If
• End Sub
19. ADDITION BUTTON
• Private Sub cmdBtnAdd_Click()
• If txtRes = 0 Then
• txtRes = cmdBtnAdd.Caption
• Else
• txtRes = txtRes + cmdBtnAdd.Caption
• End If
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Add"
• End If
• End Sub
20. SUBSTRACTION BUTTON
• Private Sub cmdBtnMns_Click()
• If txtRes = 0 Then
• txtRes = cmdBtnMns.Caption
• Else
• txtRes = txtRes + cmdBtnMns.Caption
• End If
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Minus"
• End If
• End Sub
22. SIN BUTTON
• Private Sub cmdBtnSin_Click()
• If txtRes = 0 Then
• txtRes = cmdBtnSin.Caption
• Else
• txtRes = txtRes + cmdBtnSin.Caption
• End If
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Sine"
• End If
• End Sub
23. COS BUTTON
• Private Sub cmdBtnCos_Click()
• If txtRes = 0 Then
• txtRes = cmdBtnCos.Caption
• Else
• txtRes = txtRes + cmdBtnCos.Caption
• End If
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Cosine"
• End If
• End Sub
24. TAN BUTTON
• Private Sub cmdBtnTan_Click()
• If txtRes = 0 Then
• txtRes = cmdBtnTan.Caption
• Else
• txtRes = txtRes + cmdBtnTan.Caption
• End If
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Tangent"
• End If
• End Sub
25. +/- BUTTON
• Private Sub cmdBtnPlusMinus_Click()
• txtRes = "-" & txtDisplay
• End Sub
26. LOG BUTTON
• Private Sub cmdBtnLog_Click()
• If txtRes = 0 Then
• txtRes = cmdBtnLog.Caption
• Else
• txtRes = txtRes + cmdBtnLog.Caption
• End If
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Logarithm"
• End If
• End Sub
27. LN BUTTON
• Private Sub cmdBtnLn_Click()
• If txtRes = 0 Then
• txtRes = cmdBtnLn.Caption
• Else
• txtRes = txtRes + cmdBtnLn.Caption
• End If
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Pure Logarithm"
• End If
• End Sub
28. SQUARE ROOT BUTTON
• Private Sub cmdBtnSqrt_Click()
• If txtRes = 0 Then
• txtRes = cmdBtnSqrt.Caption
• Else
• txtRes = txtRes + cmdBtnSqrt.Caption
• End If
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Square Root"
• End If
• End Sub
29. % BUTTON
• Private Sub cmdBtnPerc_Click()
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• End If
• txtRes = txtDisplay.Text / 100
• MsgBox "Your Answer is " & txtRes.Text
• End Sub
30. MOD BUTTON
• Private Sub cmdBtnMod_Click()
• If txtRes = 0 Then
• txtRes = cmdBtnMod.Caption
• Else
• txtRes = txtRes + cmdBtnMod.Caption
• End If
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Modulus"
• End If
• End Sub
31. 10^x BUTTON
• Private Sub cmdBtnTentoX_Click()
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Ten^x"
• End If
• txtRes = 10 ^ txtDisplay.Text
• MsgBox "Your Answer is " & txtRes.Text
• End Sub
32. INV BUTTON
• Private Sub cmdBtnInv_Click()
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Inverse"
• End If
• txtRes = txtDisplay.Text ^ -1
• MsgBox "Your Answer is " & txtRes.Text
• End Sub
33. ^ BUTTON
• Private Sub cmdBtnExp_Click()
• If txtRes = 0 Then
• txtRes = cmdBtnExp.Caption
• Else
• txtRes = txtRes + cmdBtnExp.Caption
• End If
• If txtRes <> 0 Then
• txtDisplay = txtRes
• txtRes = 0
• calVal = "Exponential"
• End If
• End Sub
34. TEXT BOX
• Private Sub txtRes_Change()
• If txtRes.TextLength > 21 Then
• txtRes.Text = Left(txtRes.Text, 21)
• Exit Sub
• End If
• End Sub
35. USER FORM
• Private Sub UserForm_Initialize()
• txtRes.MaxLength = 21
• txtDisplay.MaxLength = 21
• End Sub