' モジュール宣言部に記述ここから −−−−−−−−−−−−−−−−−−−−−−−−−−
Public Declare Sub Sleep Lib "kernel32" (ByVal dwmilliseconds As Long)
' モジュール宣言部に記述ここまで −−−−−−−−−−−−−−−−−−−−−−−−−−
Public Sub test()
Dim WrkPicture(9) As Picture
Dim i As Long
For i = 0 To 9
Set WrkPicture(i) = ActiveSheet.Pictures.Insert(LCase(ThisWorkbook.Path _
& "\img\" & i & ".gif"))
If i <> 0 Then
WrkPicture(i - 1).Delete
Set WrkPicture(i - 1) = Nothing
End If
Call Sleep (100)
DoEvents
Next i
WrkPicture(i - 1).Delete
Set WrkPicture(i - 1) = Nothing
End Sub
' ワークシートモジュールに記述ここから −−−−−−−−−−−−−−−−−−−−−−−
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call test
End Sub
' ワークシートモジュールに記述ここまで −−−−−−−−−−−−−−−−−−−−−−−
Public Sub test()
Dim WrkRange As ShapeRange
Dim i As Long
For i = 0 To 9
Set WrkRange = ActiveSheet.Shapes.Range("animation")
WrkRange.Fill.UserPicture LCase(ThisWorkbook.Path _
& "\img\" & i & ".gif")
Set WrkRange = Nothing
Call Sleep(100)
DoEvents
Next i
Set WrkRange = ActiveSheet.Shapes.Range("animation")
WrkRange.Fill.Visible = msoFalse
Set WrkRange = Nothing
End Sub
' ワークシートモジュールに記述ここから −−−−−−−−−−−−−−−−−−−−−−−
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim WrkRange As ShapeRange
Set WrkRange = ActiveSheet.Shapes.Range("animation")
WrkRange.Top = Target.Top
WrkRange.Left = Target.Left
Set WrkRange = Nothing
Call test
End Sub
' ワークシートモジュールに記述ここまで −−−−−−−−−−−−−−−−−−−−−−−