Any code can make the following pattern? Thanks!
* A B C D E
1 1 2 3 4 5
2 2 3 4 5 1
3 3 4 5 1 2
4 4 5 1 2 3
5 5 1 2 3 4
Any code can make the following pattern? Thanks!
* A B C D E
1 1 2 3 4 5
2 2 3 4 5 1
3 3 4 5 1 2
4 4 5 1 2 3
5 5 1 2 3 4
My first try
[VBA]Cells(1, 1).Resize(, 6).Value = Array(Chr(42), "A", "B", "C", "D", "E")
Cells(2, 1).Resize(, 6).Value = Array(1, 1, 2, 3, 4, 5)
Cells(3, 1).Resize(, 6).Value = Array(2, 2, 3, 4, 5, 1)
Cells(4, 1).Resize(, 6).Value = Array(3, 3, 4, 5, 1, 2)
Cells(5, 1).Resize(, 6).Value = Array(4, 4, 5, 1, 2, 3)
Cells(6, 1).Resize(, 6).Value = Array(5, 5, 1, 2, 3, 4)[/VBA]
You could put =MOD(ROW()+COLUMN()-2, 5)+1 in A1 and drag down and right
wow man how did you find the logical pattern here?Originally Posted by mikerickson
If you don't wanna drag and using mikerickson brilliant idea then
[VBA]Range("A1:E5").FormulaR1C1 = "=MOD(ROW()+COLUMN()-2, 5)+1"[/VBA]