Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim Plage As Range, Cel As Range
Set Plage = Feuil1.[G23:L34] 'CodeName de la feuille depart
'Set Plage = Sh.[DD11:DI22] 'si c'est utile
Set Cel = Sh.[H7]
If Cel.Comment Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Sh.Unprotect
'Plage.EntireRow.Hidden = False 'si nécessaire
'Plage.EntireColumn.Hidden = False
Plage.CopyPicture
With Workbooks.Add 'nouveau document (Zoom 100%)
With .Sheets(1).ChartObjects.Add(0, 0, Plage.Width, Plage.Height).Chart
.Paste
.Export ThisWorkbook.Path & "\MonImage.gif", "GIF"
End With
.Sheets(1).[A1].Copy .Sheets(1).[A1] 'vide le presse-papier
.Close False 'supprime le document avec le graphique temporaire
End With
Cel.Comment.Delete
With Cel.AddComment("").Shape
.Width = Plage.Width
.Height = Plage.Height
.Fill.UserPicture ThisWorkbook.Path & "\MonImage.gif"
End With
Kill ThisWorkbook.Path & "\MonImage.gif" 'supprime le fichier gif
'Plage.EntireColumn.Hidden = True 'si nécessaire
Sh.Protect
End Sub