Excel - Combinar números

 
Vista:

Combinar números

Publicado por Jairo (1 intervención) el 06/09/2015 19:04:31
Buenas si me ayudan a como convinar números del 1 al 35 en grupos de 5,sin que se repitan! Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Combinar números

Publicado por yktu (11 intervenciones) el 07/09/2015 01:39:35
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Option Explicit
Option Base 1
 
Private Const cMAX = 7
 
Sub Shuffle35()
Dim i%, j%
Dim col() As New Collection
Dim n As New Collection
 
On Error Resume Next
Cells.Clear
For i = 1 To 35
    n.Add i
Next
 
ReDim col(cMAX) As New Collection
j = 1
Randomize
Do While (1)
   With n
    i = Int((.Count * Rnd) + 1)
    col(j).Add .Item(i)
    .Remove (i)
   End With
   If col(j).Count = 5 Then j = j + 1
   If j > cMAX Then Exit Do
Loop
 
For j = 1 To cMAX
    For i = 1 To 5
        Range("A1").Offset(i - 1, j - 1) = col(j).Item(i)
    Next
Next
 
Erase col
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar