1. Calculator in EXCEL - VISUAL BASIC:
Private Sub Command15_Click()
num1 = Text1.Text
Dim op As String Text1.Text = ""
Dim num1 As Integer op = "/"
Dim num2 As Integer Command15.Visible = False
Command21.Visible = True
Private Sub Command1_Click() End Sub
Text1.Text = Text1.Text & 1
End Sub Private Sub Command16_Click()
num1 = Text1.Text
Private Sub Command10_Click() Text1.Text = ""
Text1.Text = Text1.Text & 0 op = "*"
End Sub Command16.Visible = False
Command22.Visible = True
Private Sub Command11_Click() End Sub
Text1.Text = Text1.Text & "."
End Sub Private Sub Command17_Click()
Text1.Text = "0"
Private Sub Command12_Click() End Sub
num2 = Text1.Text
If op = "+" Then Private Sub Command19_Click()
Text1.Text = num1 + num2 num2 = Text1.Text
ElseIf op = "/" Then If op = "+" Then
Text1.Text = num1 / num2 Text1.Text = num1 + num2
ElseIf op = "*" Then ElseIf op = "/" Then
Text1.Text = num1 * num2 Text1.Text = num1 / num2
ElseIf op = "-" Then ElseIf op = "*" Then
Text1.Text = num1 - num2 Text1.Text = num1 * num2
End If ElseIf op = "-" Then
End Sub Text1.Text = num1 - num2
End If
Private Sub Command13_Click() Command13.Visible = True
num1 = Text1.Text Command19.Visible = False
Text1.Text = "" End Sub
op = "+"
Command13.Visible = False Private Sub Command2_Click()
Command19.Visible = True Text1.Text = Text1.Text & 2
End Sub End Sub
Private Sub Command14_Click() Private Sub Command20_Click()
num1 = Text1.Text num2 = Text1.Text
Text1.Text = "" If op = "+" Then
op = "-" Text1.Text = num1 + num2
Command14.Visible = False ElseIf op = "/" Then
Command20.Visible = True Text1.Text = num1 / num2
End Sub ElseIf op = "*" Then
Text1.Text = num1 * num2
2. ElseIf op = "-" Then Command16.Visible = True
Text1.Text = num1 - num2 Command22.Visible = False
End If End Sub
Command14.Visible = True
Command20.Visible = False Private Sub Command3_Click()
End Sub Text1.Text = Text1.Text & 3
End Sub
Private Sub Command21_Click()
num2 = Text1.Text Private Sub Command4_Click()
If op = "+" Then Text1.Text = Text1.Text & 4
Text1.Text = num1 + num2 End Sub
ElseIf op = "/" Then
Text1.Text = num1 / num2 Private Sub Command5_Click()
ElseIf op = "*" Then Text1.Text = Text1.Text & 5
Text1.Text = num1 * num2 End Sub
ElseIf op = "-" Then
Text1.Text = num1 - num2 Private Sub Command6_Click()
End If Text1.Text = Text1.Text & 6
End Sub End Sub
Private Sub Command22_Click() Private Sub Command7_Click()
num2 = Text1.Text Text1.Text = Text1.Text & 7
If op = "+" Then End Sub
Text1.Text = num1 + num2
ElseIf op = "/" Then Private Sub Command8_Click()
Text1.Text = num1 / num2 Text1.Text = Text1.Text & 8
ElseIf op = "*" Then End Sub
Text1.Text = num1 * num2
ElseIf op = "-" Then Private Sub Command9_Click()
Text1.Text = num1 - num2 Text1.Text = Text1.Text & 9
End If End Sub