Option Explicit
Sub DéplacImage1()
Dim Img As Excel.Picture, PosImg As Integer, NbImg As Integer, _
Gauche As Double, Largeur As Double, Dessus As Double, Bas As Double
If Not TypeOf Selection Is Excel.Picture Then
If MsgBox("Veuillez sélectionner une image", vbOKCancel, "DéplacImage1") _
= vbOK Then Application.OnTime Now + TimeSerial(0, 0, 3), "DéplacImage1"
Exit Sub: End If
Set Img = Selection
PosImg = Application.InputBox("Position 1,2,3...", "POSITION DE L'IMAGE", Type:=1)
NbImg = ActiveSheet.[G1].Value
With ActiveSheet.[B2:B6]: Gauche = .Left: Largeur = .Width
Dessus = .Top: Bas = Dessus + .Height: End With
Img.Top = IntpoLin(PosImg, 0.5, Dessus, NbImg + 0.5, Bas) - Img.Height / 2
Img.Left = Gauche + (Largeur - Img.Width) / 2
End Sub
Function IntpoLin(ByVal X As Double, ByVal X1 As Double, ByVal Y1 As Double, _
ByVal X2 As Double, ByVal Y2 As Double) As Double
IntpoLin = Y1 + (Y2 - Y1) * (X - X1) / (X2 - X1)
End Function