procedure

chiamata di procedura


vedi
matema9.xls

Private Sub CommandButton1_Click()
Rem matema9
'chiamata di procedura
Call calcolare(10, 20)
End Sub

Public Sub calcolare(a As Integer, b As Integer)
Dim somma As Integer
Dim prodotto As Integer
somma = a + b
prodotto = a * b
Cells(1, 2) = somma
Cells(2, 2) = prodotto
End Sub

Private Sub CommandButton2_Click()
Dim b As Integer
Dim a As Integer
a = Cells(1, 4)
b = Cells(1, 5)
Call calcolare1(a, b)
End Sub

Public Sub calcolare1(a As Integer, b As Integer)
Dim somma, prodotto As Integer
somma = a + b
prodotto = a * b
Cells(4, 2) = somma
Cells(5, 2) = prodotto
End Sub


Private Sub CommandButton3_Click()
Rem cancella
For k = 1 To 6
For h = 1 To 6
Cells(k, h) = ""
Next h
Next k
End Sub