Sorry,
Prefer this one:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim I
On Error GoTo ERR_001
If Not Intersect(Range("A1:A2"), Target) Is Nothing Then
Application.EnableEvents = False
Range("B:B") = ""
For I = 0 To [A1] * [A2] - 1
Cells(I + 1, 2) = I Mod [A1] + 1
Next I
End If
ERR_001:
Application.EnableEvents = True
End Sub
"Charabeuh" a écrit dans le message de groupe de discussion :
[email protected]...
Hello,
Try this in the code of the sheet
(N=20 in cell A1 and REPEAT=2 in cell A2)
Private Sub Worksheet_Change(ByVal Target As Range)
Dim I
If Intersect(Range("A1:A2"), Target) Is Nothing Then Exit Sub
Range("B:B") = ""
For I = 0 To [A1] * [A2] - 1
Cells(I + 1, 2) = I Mod [A1] + 1
Next I
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
"Mike" a écrit dans le message de groupe de discussion :
(e-mail address removed)...
Hi,
Say, based on a pre-defined number N in cel A1, I want in column B to
have all numbers be listed from 1 to N?
How is this doable?
Thanks,
Mike
Forgot one more thing, after numbers are listed in column B from 1 to
N once, I want next to be able to tell how many times I want those
numbers to be repeated?!
So, if N=20, values from 1 to 20 are then listed in column B (from cel
B1 to B20), followed by another list of those numbers from 1 to N
(from B21 to B40)