chiamata di procedura
chiamata di procedura con dati inseriti in celle del foglio
vedi formato12.xls
Option Explicit
Private Sub CommandButton1_Click()
Rem formato12
Rem chiamata di procedura
Call prodotto(10, 20)
End Sub
Private Sub prodotto(a As
Integer, b As Integer)
Dim prodotto As Integer
prodotto = a * b
Cells(1, 1) = prodotto
End Sub
Private Sub CommandButton2_Click()
Rem chiamata di procedura
Call calcolare(Cells(1,
2), Cells(1, 3))
End Sub
Private Sub calcolare(x As
Integer, y As Integer)
Dim somma, prodotto As Integer
somma = x + y
prodotto = x * y
Cells(3, 2) = somma
Cells(3, 3) = prodotto
End Sub
Private Sub CommandButton3_Click()
Rem cancellare
Cells(1, 1) = ""
Cells(1, 2) = ""
Cells(1, 3) = ""
Cells(3, 2) = ""
Cells(3, 3) = ""
End Sub