Making Contents of a cell input for a Module

A

anyuan

I am currently using this code in a module for a excel worksheet.
want to simply use excel to create variations of groups for a 2 wee
period and list them in a spreadsheet. The following code lis
variations for 3 different people (I link the people to a number code)
but I want the group size to be dynamic (the cell that uses the permut
function) will determine the group size. For example instead of jus
printing all the variations for 1,2, andn 3 I want it to print th
variations for 1,2,3,4,5, etc. up to 9 different group members. Pleas
help me.

Sub Variations()
RowNr = 1
Ilow = 0
For I = 0 To 9
For J = 0 To 9
If J <> I Then
For K = 0 To 9
If K <> J And K <> I Then
For L = 0 To 9
If L <> K And L <> J And L <> I Then
Cells(RowNr, 2) = I * 1000 + J * 100 + K * 10 + L
RowNr = RowNr + 1
End If
Next L
End I
 
Top