マクロ作成方法 7(N4ボックス後追い数字集計(重複有))
マクロ作成方法 8 (N4ボックス後追い数字集計(重複無))
前回の当選番号に対して、次回の当選番号の数字を重複集計します。
(図1) 関数を使い4桁の当選数字を1桁づつ4つに分ける
↓ ↓ ↓ ↓
(図2) (図1)の1桁づつ4つのデータからマクロで後追い集計をする。
(集計は、前1149と後7921の場合 1と1,2,7,9 1と1,2,7,9 4と1,2,7,9 9と1,2,7,9)
(注)同じ番号同志での後追い集計は引っ張り集計にもなります。
マクロの考え方はロト6の後追い数字集計と同じで、前回の1個づつに対してそれぞれ
4個の次回数字を集計します。下記の簡単なマクロで集計してます。
Sub n4bx_allato_oi() 'N4ボックス後追い集計(重複有)
Dim xa As long, ya As long, i As long, ii As long, iii As long
Sheets("出現数").Select
Range("Hr5:ia14").Select
Selection.ClearContents ’データ出力セルのクリア
Call saikeisanoff '再計算等停止 マクロ作成方法 1 と同様
i = 5 ’5行目から開始
Do Until Sheets("ストレートパターン").Cells(i, 3) = ""
For ii = 4 To 7 '前の番号の4列から7列のデータ処理
xa = Sheets("ストレートパターン").Cells(i - 1, ii) '前の数字(i - 1)最初は図1のD4~G4
For iii = 4 To 7 '後の番号の4列から7列のデータ処理
ya = Sheets("ストレートパターン").Cells(i, iii) '後の数字 最初は図1のD5~G5
Cells(5 + ya, 226 + xa) = Cells(5 + ya, 226 + xa) + 1 '集計
Next iii
Next ii
i = i + 1
Loop
Call saikeisanon '再計算等をする
Range("HR5:IA14").Select '自動記録マクロでHR5:IA14のセル範囲を条件塗りつぶし
Selection.FormatConditions.AddAboveAverage
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
Selection.FormatConditions(1).AboveBelow = xlAboveAverage
With Selection.FormatConditions(1).Font
.Color = -16752384
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13561798
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.AddAboveAverage
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
Selection.FormatConditions(1).AboveBelow = xlBelowAverage
With Selection.FormatConditions(1).Font
.Color = -16383844
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13551615
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Cells(1, 224).Select
Cells(1, 224) = i - 4 & " 回"
End Sub