全組み合わせの一覧表を作ればよいので For~Next のネスト処理でできます。
やり方は色々あると思いますが、赤を3、黄を2、青を1 に置き換えて処理してみました。
Sheet2 に結果を出力します。
Sub Test()
Dim A As String, B As String, C As String, D As String
Dim E As String, F As String, G As String, H As String
Dim cntA As Long, cntB As Long, cntC As Long, cntD As Long
Dim cntE As Long, cntF As Long, cntG As Long, cntH As Long
Dim cnt As Long
Sheets("Sheet2").Activate
Range("A1").Value="A"
Range("B1").Value="B"
Range("C1").Value="C"
Range("D1").Value="D"
Range("E1").Value="E"
Range("F1").Value="F"
Range("G1").Value="G"
Range("H1").Value="H"
Range("I1").Value="Max"
A = "321"
B = "31"
C = "31"
D = "31"
E = "31"
F = "31"
G = "31"
H = "331"
cnt = 1
For cntA = 1 To Len(A)
For cntB = 1 To Len(B)
For cntC = 1 To Len(C)
For cntD = 1 To Len(D)
For cntE = 1 To Len(E)
For cntF = 1 To Len(F)
For cntG = 1 To Len(G)
For cntH = 1 To Len(H)
cnt = cnt + 1
Cells(cnt, 1) = Val(Mid(A, cntA, 1))
Cells(cnt, 2) = Val(Mid(B, cntB, 1))
Cells(cnt, 3) = Val(Mid(C, cntC, 1))
Cells(cnt, 4) = Val(Mid(D, cntD, 1))
Cells(cnt, 5) = Val(Mid(E, cntE, 1))
Cells(cnt, 6) = Val(Mid(F, cntF, 1))
Cells(cnt, 7) = Val(Mid(G, cntG, 1))
Cells(cnt, 8) = Val(Mid(H, cntH, 1))
Cells(cnt, 9).Value = WorksheetFunction.Max(Range("A" & cnt & ":G" & cnt))
Next
Next
Next
Next
Next
Next
Next
Next
End Sub
お礼
ご回答頂きましてありがとうございました。 補足コメントの内容は自分で解決してみようと思います。