VBA キャラクターの顔がきょろきょろ

パソコン操作

顔が動きます。

Sub CellClear()
Dim i As Long
Dim j As Long

For j = 1 To 8
    For i = 1 To 14
      Cells(j, i).Interior.ColorIndex = xlNone
    Next i
Next j
End Sub


Sub MarioKyorokyoro()
Dim Color1 As Long
Dim Color2 As Long
Dim Color3 As Long
Dim i As Long
Dim j As Long
Dim k As Long
Dim time As Long

time = 100
'スクリーンのズーム調整
    Cells.Select
    Selection.ColumnWidth = 4.88
    Selection.RowHeight = 30
    'Selection.Clear
    ActiveWindow.Zoom = 80
        Cells(1, 1).Select
    

Color1 = RGB(255, 0, 0)      '赤
Color2 = RGB(0, 128, 0)   '緑
Color3 = RGB(255, 210, 160) '肌色

For k = 1 To 20

Call CellClear

'顔
    '2行目
    For i = 5 To 9
        Cells(2, i).Interior.Color = Color1
    Next i
    '3行目
    For i = 4 To 12
        Cells(3, i).Interior.Color = Color1
    Next i
    '4行目
    For i = 4 To 6
        Cells(4, i).Interior.Color = Color2
    Next i
    For i = 7 To 8
        Cells(4, i).Interior.Color = Color3
    Next i
        Cells(4, i).Interior.Color = Color2
        i = i + 1
        Cells(4, i).Interior.Color = Color3
    '5行目
    i = 3
        Cells(5, i).Interior.Color = Color2
        i = i + 1
        Cells(5, i).Interior.Color = Color3
        i = i + 1
        Cells(5, i).Interior.Color = Color2
        i = i + 1
        Cells(5, i).Interior.Color = Color3
        i = i + 1
        Cells(5, i).Interior.Color = Color3
        i = i + 1
        Cells(5, i).Interior.Color = Color3
        i = i + 1
        Cells(5, i).Interior.Color = Color2
        i = i + 1
        Cells(5, i).Interior.Color = Color3
        i = i + 1
        Cells(5, i).Interior.Color = Color3
        i = i + 1
        Cells(5, i).Interior.Color = Color3
        i = i + 1
    '6行目
    i = 3
        Cells(6, i).Interior.Color = Color2
        i = i + 1
        Cells(6, i).Interior.Color = Color3
        i = i + 1
        Cells(6, i).Interior.Color = Color2
        i = i + 1
        For j = 1 To 2
            Cells(6, i).Interior.Color = Color2
            i = i + 1
            Cells(6, i).Interior.Color = Color3
            i = i + 1
            Cells(6, i).Interior.Color = Color3
            i = i + 1
            Cells(6, i).Interior.Color = Color3
            i = i + 1
        Next j
    '7行目
    i = 3
        For j = 1 To 2
            Cells(7, i).Interior.Color = Color2
            i = i + 1
        Next j
        For j = 1 To 4
            Cells(7, i).Interior.Color = Color3
            i = i + 1
        Next j
        For j = 1 To 4
            Cells(7, i).Interior.Color = Color2
            i = i + 1
        Next j
    '8行目
    i = 5
        For j = 1 To 7
            Cells(8, i).Interior.Color = Color3
            i = i + 1
        Next j
        Application.Wait [now() ] + time / 86400000

Call CellClear
'顔
    '2行目
    For i = 6 To 10
        Cells(2, i).Interior.Color = Color1
    Next i
    '3行目
    For i = 3 To 11
        Cells(3, i).Interior.Color = Color1
    Next i
    '4行目
        i = 5
        Cells(4, i).Interior.Color = Color3
        i = i + 1
        Cells(4, i).Interior.Color = Color2
    For i = 7 To 8
        Cells(4, i).Interior.Color = Color3
    Next i
    For i = 9 To 11
        Cells(4, i).Interior.Color = Color2
    Next i
    '5行目
    For i = 3 To 5
        Cells(5, i).Interior.Color = Color3
    Next i
        Cells(5, i).Interior.Color = Color2
    For i = 7 To 9
        Cells(5, i).Interior.Color = Color3
    Next i
        Cells(5, i).Interior.Color = Color2
        i = i + 1
        Cells(5, i).Interior.Color = Color3
        i = i + 1
        Cells(5, i).Interior.Color = Color2
    '6行目
    i = 2
        For j = 1 To 2
            Cells(6, i).Interior.Color = Color3
            i = i + 1
            Cells(6, i).Interior.Color = Color3
            i = i + 1
            Cells(6, i).Interior.Color = Color3
            i = i + 1
            Cells(6, i).Interior.Color = Color2
            i = i + 1
        Next j
    i = 10
        Cells(6, i).Interior.Color = Color2
        i = i + 1
        Cells(6, i).Interior.Color = Color3
        i = i + 1
        Cells(6, i).Interior.Color = Color2
        i = i + 1
    '7行目
    i = 3
        For j = 1 To 4
            Cells(7, i).Interior.Color = Color2
            i = i + 1
        Next j
        For j = 1 To 4
            Cells(7, i).Interior.Color = Color3
            i = i + 1
        Next j
        For j = 1 To 2
            Cells(7, i).Interior.Color = Color2
            i = i + 1
        Next j
    '8行目
    i = 4
        For j = 1 To 7
            Cells(8, i).Interior.Color = Color3
            i = i + 1
        Next j
        Application.Wait [now() ] + time / 86400000


Next k
End Sub