uso di Each c in Selection

Rem uso di Each c in Selection


vedi
matema12.xls

Private Sub CommandButton1_Click()
Rem uso di Each c in Selection
Dim valore As Variant
Dim c As Variant
Dim k As Integer
Dim h As Integer
k = 10
h = 0
'se la cella contiene numero positivo
'questo viene moltiplicato per 10 e per 100 e inserito in nuova cella
For Each c In Selection
valore = c.Value
If valore > 0 Then
h = h + 1
Cells(h, 3) = c.Value * k
Cells(h, 4) = c.Value * 100
End If
Next c
End Sub

Private Sub CommandButton2_Click()
Rem cancellare
For k = 1 To 11
For h = 1 To 5
Cells(k, h) = ""
Next h
Next k

End Sub