|
私も考えてみました。
元位置は、セルのコメントに記録するようにしています。
予め、画像には名前をつけておいてください。
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range
Dim p As Picture
Dim s As String
Dim c As Range
Dim v
Set r = Range("A1:A10")
If Intersect(Target, r) Is Nothing Then Exit Sub
If Target.Count <> 1 Then Exit Sub
On Error Resume Next
Set p = Pictures(Target.Value)
On Error GoTo 0
If p Is Nothing Then
MsgBox "その名前の画像はありません"
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
Exit Sub
End If
Application.EnableEvents = False
For Each c In r
s = c.NoteText
If s <> "" Then
v = Split(s, ",")
With Shapes(v(0))
.Top = v(1)
.Left = v(2)
End With
End If
If c.Address <> Target.Address Then
c.ClearComments
c.ClearContents
End If
Next
Application.EnableEvents = True
Target.NoteText p.Name & "," & p.Top & "," & p.Left
p.Top = Target.Top
p.Left = Target.Width
End Sub
|
|