Salut gelinote
à ton avis quel est le macro que je dois utiliser celui la ou bien l'autre je suis tiraille
Visualise une photo externe au survol d'une cellule
Dim Xc, Yc
Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
d = 3
If X < d Or X > Label1.Width - d Or Y < d Or Y > Label1.Height - d Then
Range("champ").Interior.ColorIndex = xlNone
Unload UserForm1
Else
Hcel = Range("champ").Cells(1, 1).Height
Lcel = Range("champ").Cells(1, 1).Width
Yc = Int(Y / Hcel)
Xc = Int(X / Lcel)
Range("champ").Interior.ColorIndex = xlNone
Range("champ").Cells(1, 1).Offset(Yc, Xc).Interior.ColorIndex = 3
RépertoirePhoto = "C:\Photos\" ' Adapter
photo = RépertoirePhoto & Range("champ").Cells(1, 1).Offset(Yc, Xc) & ".jpg"
If Dir(photo) <> "" Then
UserForm1.Image1.Picture = LoadPicture(photo)
UserForm1.Show
Else
UserForm1.Hide
End If
End If
End Sub
Private Sub Label1_Click()
Range("champ").Interior.ColorIndex = xlNone
Range("champ").Cells(1, 1).Offset(Yc, Xc).Select
Range("champ").Cells(1, 1).Offset(Yc, Xc).Interior.ColorIndex = 4
ActiveSheet.Label1.Visible = False
Range("champ").Cells(1, 1).Offset(Yc, Xc).Select
AppActivate "Microsoft Excel"
ActiveSheet.Label1.Width = Range("champ").Width
ActiveSheet.Label1.Height = Range("champ").Height
ActiveSheet.Shapes("label1").Top = Range("champ").Top + 1
ActiveSheet.Shapes("label1").Left = Range("champ").Left + 1
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect([champ], Target) Is Nothing Then
Unload UserForm1
essaye de l'utiliser avec ce macros
merci