1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
' déclaration des variables
Dim OS15, OS40, OS60, telephone As String
Dim Sh As Shape
' Récupération des fichiers
OS15 = "D:\Bibliotheque\OS15.jpg"
OS40 = "D:\Bibliotheque\OS40.jpg"
OS60 = "D:\Bibliotheque\OS60.jpg"
' Suppression des images existantes
For Each Sh In Worksheets("Profils").Shapes
If Left(Sh.Name, 6) = "Profil" Then Sh.Delete
Next
On Error GoTo errorhandler
' test de la valeur et ajout de l'image en fonction
If Worksheets("Profils").Range("C7").Value <> "" Then
positionX1 = "S5"
positionY1 = "S5"
Select Case Left(Worksheets("Profils").Range("C7").Value, 12)
Case "OpenStage 15"
telephone = OS15
Case "OpenStage 40"
telephone = OS40
Case "OpenStage 60"
telephone = OS60
Case Else
telephone = OS15
End Select
Set Sh = Feuil5.Shapes.AddPicture(telephone, msoFalse, msoCTrue, Range(positionX1).Left, Range(positionY1).Top, 60, 45)
With Sh
.Name = "Profil_Tel"
End With
End If
Exit Sub
errorhandler:
End Sub |
Partager