We will join the zero logic prompts and dialog boxes in addition.
Behind it is simple ~ ~ ~
Provide renderings with the code
The sample code
Sub rectangular 1_Click () ' ' rectangular 1_Click Macro ' code editor Dim number1 of As Integer Dim number2 of As Integer number1 = Cells ( . 5 , . 4 ) number2 = Cells ( . 6 , . 4 ) Cells ( . 7 , . 4 ) = number1 + number2 End Sub Sub rectangular 2_Click () ' ' rectangular Macro 2_Click ' Dim number1 of As Integer Dim number2As Integer number1 = Cells(5, 4) number2 = Cells(6, 4) Cells(7, 4) = number1 - number2 End Sub Sub 矩形4_Click() ' ' 矩形4_Click Macro ' Dim number1 As Integer Dim number2 As Integer number1 = Cells(5, 4) number2 = Cells(6, 4) Cells ( . 7 , . 4 ) = number1 * number2 End Sub Sub rectangular 5_Click () ' ' rectangular 5_Click Macro ' number1 = Cells ( . 5 , . 4 ) number2 = Cells ( . 6 , . 4 ) the If number2 = 0 the Then MsgBox ( " divisor can not be zero ~ " ) Else Cells ( . 7 , . 4 ) = number1 / number2 End the If End Sub
references:
https://www.yiibai.com/vba/vba_message_box.html