uso di For Each c in Selection

uso di For Each c in Selection:variante
vedi
matema13.xls

Option Explicit

Private Sub CommandButton1_Click()
Rem matema13
'selezionare le colonne A,B e poi cliccare su pulsante
Dim valore As Variant
Dim c As Variant
Dim k, h, g As Integer
k = 10
h = 0
g = 100
For Each c In Selection
valore = c.Value
If valore > 0 Then
h = h + 1
Cells(h, 4) = c.Value
Cells(h, 5) = c.Value * k
Cells(h, 6) = c.Value * g
End If
Next c
End Sub


Private Sub CommandButton2_Click()
Rem cancellare
Dim k, h As Integer
For k = 1 To 11
For h = 1 To 6
Cells(k, h) = ""
Next h
Next k
End Sub