|
??? |
|
エクセルのマクロ
Option Explicit Dim a(4) As Integer, b(14) As Integer, c(4) As Integer Dim m As Integer Sub Macro1() Cells(1, 1).Value = 0 Call saiki1(1) End Sub Sub saiki1(ByVal n As Integer) Dim dame As Integer, wa As Integer, j As Integer If n = 1 Then a(1) = 1 Else a(n) = a(n - 1) + 1 While a(n) <= 15 If n < 4 Then Call saiki1(n + 1) Else For j = 0 To 14: b(j) = 0: Next j For m = 1 To 4: Call saiki2(1): Next m For j = 0 To 14 If b(j) = 0 Then dame = 1 Next j If dame = 0 Then wa = 0: For j = 1 To 4: wa = wa + a(j): Next j If Cells(1, 1).Value < wa Then Cells(1, 1).Value = wa For j = 1 To 4: Cells(1, j + 1).Value = a(j): Next j End If End If End If a(n) = a(n) + 1 Wend End Sub Sub saiki2(ByVal n As Integer) Dim wa As Integer, j As Integer If n = 1 Then c(1) = 1 Else c(n) = c(n - 1) + 1 While c(n) <= 4 If n < m Then Call saiki2(n + 1) Else wa = 0: For j = 1 To m: wa = (wa + a(c(j))) Mod 15: Next j b(wa) = 1 End If c(n) = c(n) + 1 Wend End Sub |
|
4月17日(木) 10:26:58
41667 |