
Sub lotto()
For i = 1 To 10
Cells(2, i + 4).Value = Cells(1, 1).Value - 1 + i
Next i
If Range("N2").Value = 10 Then Range("N2").Value = 90
End Sub |
={12345678990}*(A1=1)+({0123456789}+A1)*((A1=10)+(A1=20)) |
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nVal As Integer
Dim aVal As Variant
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
nVal = Me.Range("A1").Value
If nVal = 1 Then
aVal = [row(1:10)]
aVal(10, 1) = 90
Else
aVal = Application.Evaluate("row(" & nVal & ":" & nVal + 9 & ")")
End If
Application.EnableEvents = False
Me.Range("E2:N2") = Application.Transpose(aVal)
Application.EnableEvents = True
End Sub
|
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nVal As Integer
Dim aVal As Variant
With Application
If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
nVal = Round(Me.Range("A1").Value)
Select Case nVal
Case 0
aVal = [row(1:10) - row(1:10)]
Case 1 To 9
aVal = [row(1:10)]
aVal(10, 1) = 90
Case Else
nVal = .Min(Int(nVal / 10) * 10, 80)
aVal = .Evaluate("row(" & nVal & ":" & nVal + 9 & ")")
End Select
.EnableEvents = False
Me.Range("E2:N2") = .Transpose(aVal)
.EnableEvents = True
End With
End Sub
|
Option Explicit
Private Sub SpinButton1_Change()
Dim S()
Dim i As Integer
S = Array(0, 1, 10, 20, 30, 40, 50, 60, 70, 80)
SpinButton1.Min = 0
SpinButton1.Max = 9
'If Foglio1.SpinButton1.Value >= 9 Then Foglio1.SpinButton1.Value = 9
Range("A1").Value = S(Foglio1.SpinButton1.Value)
If Cells(1, 1).Value = 0 Then [E2:N2] = 0: Exit Sub
For i = 1 To 10
Cells(2, i + 4).Value = Cells(1, 1).Value - 1 + i
Next i
If Range("N2").Value = 10 Then Range("N2").Value = 90
End Sub |
