Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://excel-egy.com/forum/t4092
- ---------------------------------
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- Dim shp As Object, c As Range, sPath As String
- If Target.Count > 1 Then Exit Sub
- If Not Intersect(Target, Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)) Is Nothing Then
- For Each shp In ActiveSheet.Pictures: shp.Delete: Next shp
- If IsEmpty(Target) Then Exit Sub
- sPath = ActiveWorkbook.Path & "\Pictures\" & Target.Offset(0, 1) & ".jpg"
- If Dir(sPath) <> "" Then
- Set c = Target.Offset(, 2)
- With ActiveSheet.Pictures.Insert(sPath)
- .Left = c.Left
- .Top = c.Top
- .Placement = xlMove
- End With
- Application.Goto Target, True
- End If
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement