controllo If then else
vedi matema4.xls
uso di If then else per controllo e selezione istruzioni

Private Sub CommandButton1_Click()
'matema4 uso di If then Else
Dim a, b, c, d As Integer
a = 100
b = 20
c = 30
d = 40
If a > b Then Cells(1, 1) = a * b
If a < b Then Cells(2, 1) = a + b
If a < b Then
Cells(3, 1) = a + b
Cells(4, 1) = a * b
Cells(5, 1) = a - b
End If
If a < b Then
Cells(6, 1) = a + b
Cells(7, 1) = a * b
Else
Cells(8, 1) = a * 10
Cells(9, 1) = b * 100
End If

End Sub