Excel VBA - Autoatically position an image when moved

Hi
I was given the code below to add an image with its top left corner on a cell
and then more code to find the cell closest to the top left corner of an image.
Now I want to add code that runs when the image is moved that automatically
positions it so that its top and left borders are exactly aligned with the cell
closest to its top left cormer. I m guessing that I need to add a handler
that runs each time the image is moved


Sub A()
     With ThisWorkbook.Sheets("Sheet1").Pictures.Insert("C:\Users\Kevin Jones\Pictures\IM Avatars\zorvek.jpg")
        .ShapeRange.IncrementLeft ThisWorkbook.Sheets("Sheet1").Range("C3").Left
        .ShapeRange.IncrementTop ThisWorkbook.Sheets("Sheet1").Range("C3").Top
        .Name = "MyPicture"
    End With
End Sub
Sub B()
    For Each shp In ActiveSheet.Shapes
    MsgBox shp.TopLeftCell.Address
    Next
End Sub
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
 
Rory ArchibaldConnect With a Mentor Commented:
There aren't any events triggered by moving pictures on a sheet, I'm afraid. What's this for?
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.