descrizione gestione variabili con VBA
ritorna con
variabili.html esci con vbasintassi1.htm


numeriche14.ppt

descrizione variabili assegnate automaticamente tipo Variant


Rem Option Explicit assente
Rem dimensionamento automatico tipo Variant
Private Sub CommandButton1_Click()
Rem senza dimensionamento
Rem assegna valore a variabili
a = 100
b = 5
c = "100"
d = "5"
Rem operatore somma + e prodotto *
somma1 = a + b
prodotto = a * b
Rem operatore unione stringhe &
somma = c + d
somma2 = a & b
Rem stampo risultati
Label2.Caption = ("prodotto * = " & prodotto)
Label3.Caption = ("somma + = " & somma)
Label4.Caption = ("somma + = " & somma1)
Label5.Caption = ("somma & = " & somma2)
End Sub

Private Sub CommandButton4_Click()
Rem dimesnionamento automatico tipo Variant
Rem assegna valore a variabili
a = "maria"
b = "rosa"
somma1 = a + b
Rem assegno operazione
somma2 = a + b
Rem stampo risultati
Label6.Caption = ("somma-unione = " & somma1)
Label7.Caption = ("somma a+b =" & somma2)
End Sub

Private Sub CommandButton2_Click()
Label31.Visible = True
End Sub

Private Sub CommandButton3_Click()
Label31.Visible = False
End Sub

Private Sub CommandButton5_Click()
Label37.Visible = True
End Sub

Private Sub CommandButton6_Click()
Label37.Visible = False
End Sub

Private Sub CommandButton7_Click()
Label30.Visible = True
End Sub

Private Sub CommandButton8_Click()
Label30.Visible = False
End Sub



Private Sub UserForm_Click()
End Sub


numeriche15.ppt
dati inseriti con TextBox1 , TextBox2 e diversa interpretazione con tipo Variant
uso di Val(x) per cambiare stringa in numero

Rem Option Explicit assente
Rem dimensionamento automatico tipo Variant
Private Sub CommandButton1_Click()
Rem senza dimensionamento
Rem assegna valore a variabili
a = TextBox1
b = TextBox2
Rem operatore somma + e prodotto *
somma = a + b
prodotto = a * b
Rem operatore unione stringhe &
somma1 = a & b
Rem stampo risultati
Label2.Caption = ("prodotto * = " & prodotto)
Label3.Caption = ("somma + = " & somma)
Label4.Caption = ("somma & = " & somma1)
Label5.Caption = ("somma + =" & Val(a) + Val(b))
End Sub


Private Sub CommandButton2_Click()
Label31.Visible = True
End Sub

Private Sub CommandButton3_Click()
Label31.Visible = False
End Sub

Private Sub CommandButton5_Click()
Label37.Visible = True
End Sub

Private Sub CommandButton6_Click()
Label37.Visible = False
End Sub

Private Sub CommandButton7_Click()
Label30.Visible = True
End Sub

Private Sub CommandButton8_Click()
Label30.Visible = False
End Sub


Private Sub UserForm_Click()
End Sub