Dim Operation As String Dim Operator1 As String Dim Operator2 As String Private Sub CommandButton0_Click() pura ("0") End Sub Private Sub CommandButton1_Click() pura ("1") End Sub Private Sub CommandButton2_Click() pura ("2") End Sub Private Sub CommandButton3_Click() pura ("3") End Sub Private Sub CommandButton4_Click() pura ("4") End Sub Private Sub CommandButton5_Click() pura ("5") End Sub Private Sub CommandButton6_Click() pura ("6") End Sub Private Sub CommandButton7_Click() pura ("7") End Sub Private Sub CommandButton8_Click() pura ("8") End Sub Private Sub CommandButton9_Click() pura ("9") End Sub Private Sub CommandButtonAdd_Click() pura ("+") End Sub Private Sub CommandButtonClear_Click() pura ("c") End Sub Private Sub CommandButtonComma_Click() pura (",") End Sub Private Sub CommandButtonDivide_Click() pura ("/") End Sub Private Sub CommandButtonEqual_Click() pura ("=") End Sub Private Sub CommandButtonMultiply_Click() pura ("*") End Sub Private Sub CommandButtonSubtract_Click() pura ("-") End Sub Private Sub pura(purku) Select Case purku Case "0" To "9" number.Caption = number.Caption + purku Case "+" Operation = "+" Operator1 = number.Caption number.Caption = "" Case "-" Operation = "-" Operator1 = number.Caption number.Caption = "" Case "*" Operation = "*" Operator1 = number.Caption number.Caption = "" Case "/" Operation = "/" Operator1 = number.Caption number.Caption = "" Case "=" Operator2 = number.Caption Select Case Operation Case "+" number.Caption = Val(Operator1) + Val(Operator2) Case "-" number.Caption = Val(Operator1) - Val(Operator2) Case "*" number.Caption = Val(Operator1) * Val(Operator2) Case "/" number.Caption = Val(Operator1) / Val(Operator2) End Select Case "c" number.Caption = "" Operator1 = "" Operator2 = "" End Select End Sub Private Sub UserForm_Initialize() number.Caption = "" End Sub