シート1のA1セルに数字を入れ、下のマクロを標準モジュールに
コピペし1と2を実行してみてください。
A1セルの数字を変えてみたら回転数が変わります。
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
------------------
Sub irorurretto1()
Dim i As Long
Dim myColorIndexArray() As Variant
myColorIndexArray = Array(1, 3, 10, 20)
For i = 0 To UBound(myColorIndexArray)
With Range("D3").Offset(, i).Interior
.ColorIndex = myColorIndexArray(i)
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
With Range("D3").Offset(, i).Interior
.ColorIndex = xlNone
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
Next
For i = 0 To UBound(myColorIndexArray)
With Range("G4").Offset(i, 0).Interior
.ColorIndex = myColorIndexArray(i)
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
With Range("G4").Offset(i, 0).Interior
.ColorIndex = xlNone
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
Next
For i = 0 To UBound(myColorIndexArray)
With Range("F7").Offset(, -i).Interior
.ColorIndex = myColorIndexArray(i)
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
With Range("F7").Offset(, -i).Interior
.ColorIndex = xlNone
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
Next
For i = 0 To UBound(myColorIndexArray)
With Range("C6").Offset(-i, 0).Interior
.ColorIndex = myColorIndexArray(i)
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
With Range("C6").Offset(-i, 0).Interior
.ColorIndex = xlNone
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
Next
End Sub
----------
-----------
Sub irorurretto2()
Dim k As Integer
Dim i As Long
Dim myColorIndexArray() As Variant
For k = 1 To Worksheets("Sheet1").Range("a1").Value
myColorIndexArray = Array(1, 3, 10, 20)
For i = 0 To UBound(myColorIndexArray)
With Range("D3").Offset(, i).Interior
.ColorIndex = myColorIndexArray(i)
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
With Range("D3").Offset(, i).Interior
.ColorIndex = xlNone
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
Next
For i = 0 To UBound(myColorIndexArray)
With Range("G4").Offset(i, 0).Interior
.ColorIndex = myColorIndexArray(i)
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
With Range("G4").Offset(i, 0).Interior
.ColorIndex = xlNone
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
Next
For i = 0 To UBound(myColorIndexArray)
With Range("F7").Offset(, -i).Interior
.ColorIndex = myColorIndexArray(i)
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
With Range("F7").Offset(, -i).Interior
.ColorIndex = xlNone
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
Next
For i = 0 To UBound(myColorIndexArray)
With Range("C6").Offset(-i, 0).Interior
.ColorIndex = myColorIndexArray(i)
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
With Range("C6").Offset(-i, 0).Interior
.ColorIndex = xlNone
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Sleep 40
Next
Next k
End Sub
---------
お礼
これです!これを知りたかったんです。ありがとうございました。