Thread: Oh4fore Thanks: 0 Likes: 0

1. Oh4fore

4 Rows and 4 columns using numbers 1 through 16 insert in the 16 numbers in all cells using every combinations should be 5 possible groups

example A1=1 B1=2 C1=3 D1=4
A2=5 B2=6 c2+7 D2=8
A3=9 B3=10 C3=11 D3=12
A4=13 B4=14 C4=15 D4=16  Reply With Quote

2. Re: Oh4fore

Hi, welcome to the board.

What is your question ?  Reply With Quote

3. Re: Oh4fore

I need 5 groups of 16 cells with the numbers 1 through 16 inserted in each group. I need #1 to be with every other number only once, . #2 with every other number only once and so on  Reply With Quote

4. Re: Oh4fore

Like this, for example?

 A B C D E F G H I J K L M N O P 1 8 6 5 11 3 10 9 16 7 4 14 2 15 1 13 12 2 12 1 7 16 5 9 2 6 8 11 13 3 14 15 10 4 3 11 14 12 1 8 3 5 15 4 6 9 7 10 13 2 16 4 5 11 2 12 9 14 13 4 3 8 1 10 6 16 15 7 5 4 15 8 6 7 2 3 1 12 16 10 5 13 14 9 11  Reply With Quote

5. Re: Oh4fore Originally Posted by Oh4fore I need 5 groups of 16 cells with the numbers 1 through 16 inserted in each group.
For the 5 groups.

 A B C D E F G H I J K L M N O P Q R S T U V W X 1 GROUP 1 GROUP 2 GROUP 3 GROUP 4 GROUP 5 2 3 10 6 2 8 14 1 16 14 1 4 9 9 6 3 14 10 14 6 13 3 12 1 9 11 11 4 12 5 12 11 3 13 7 4 10 1 3 7 2 5 4 15 5 14 7 2 15 7 3 15 10 5 8 15 8 12 13 16 12 11 1 5 16 4 8 13 9 13 6 10 6 7 16 2 2 11 16 5 4 9 8 15

Try this:

Code:
Sub Groups5()
Dim dict As Object, i As Long, x As Long, y As Long, j As Long
Set dict = CreateObject("scripting.dictionary")
For i = 1 To 16
dict(i) = i
Next
For j = 1 To 5
For i = 1 To 16
x = WorksheetFunction.RandBetween(1, 16)
y = dict(x)
dict(x) = dict(i)
dict(i) = y
Next
i = 1
For Each c In Cells(2, ((j - 1) * 5) + 1).Resize(4, 4)
c.Value = dict(i)
i = i + 1
Next
Next
End Sub  Reply With Quote

User Tag List

Tags for this Thread

c1=3, calc, d2=8, numbers, oh4fore  Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•