Sub Images()
Dim ps$, h As Hyperlink, had$, p%, ext$, c As Range, cad$, s As Shape
ps = Application.PathSeparator
Application.ScreenUpdating = False
With Sheets("Feuil1") 'à adapter
.Visible = xlSheetVisible 'au cas où...
For Each h In .Hyperlinks
had = h.Address
p = InStrRev(had, ".")
If p Then
ext = Mid(had, p)
If ext = ".jpg" Or ext = ".jpeg" Or ext = ".png" Or ext = ".gif" Or ext = ".tiff" Then
If Not had Like "?:" & ps & "*" Then had = ThisWorkbook.Path & ps & had
Set c = h.Parent.Offset(, 1) 'cellule à droite
cad = c.Address
For Each s In .Shapes
If s.TopLeftCell.Address = cad Then s.Delete 'vide la cellule
Next s
With .Pictures.Insert(had) 'insère l'image dans la feuille
.ShapeRange.LockAspectRatio = msoTrue 'verrouille le rapport hauteur/largeur
.Height = c.Height - 2
If .Width > c.Width Then .Width = c.Width - 2
.Top = c.Top + (c.Height - .Height) / 2
.Left = c.Left + (c.Width - .Width) / 2
End With
End If
End If
Next h
End With
End Sub