Bonsoir
C'est possible par VBA en utilisant les évènements des graphiques
Le graphique doit être activé pour que ça fonctionne
(cet exemple n'est pas optimisé)
'--------------------------------
'Dans le module du classseur ThisWorkbook
Option Explicit
Dim ClTabChart As ClasseChart
Private Sub Workbook_Open()
Dim i As Integer
Set ClTabChart = New ClasseChart
'Spécifie le 1er graphique de la Feuil1
Set ClTabChart.Graph = Worksheets("Feuil1").ChartObjects(1).Chart
Worksheets("Feuil1").ChartObjects(1).Activate
Set Sh = ActiveChart.Shapes.AddTextbox _
(msoTextOrientationHorizontal, 100, 100, 200#, 100#)
Sh.Visible = msoFalse
Sh.Name = "Rectangle 1"
'désactive les intitulés et les valeurs
Application.ShowChartTipNames = False
Application.ShowChartTipValues = False
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sh.Delete
'réactive les intitulés et les valeurs
Application.ShowChartTipNames = True
Application.ShowChartTipValues = True
End Sub
'---------------------------
'Dans un module standard
Option Explicit
Public Sh As Shape
'-------------------------
'Dans un module de classe nommé ClasseChart
Option Explicit
Public WithEvents Graph As Chart
'*** Utilisation des évènements *********
Private Sub Graph_MouseMove(ByVal Button As Long, ByVal Shift As Long, _
ByVal x As Long, ByVal y As Long)
Dim ElementID As Long
Dim Arg1 As Long, Arg2 As Long
On Error Resume Next
ActiveChart.GetChartElement x, y, ElementID, Arg1, Arg2
If Arg2 = 0 Then
ActiveChart.Shapes("Rectangle 1").Visible = msoFalse
Else
With ActiveChart.Shapes("Rectangle 1")
.Visible = msoTrue
.TextFrame.Characters.Text = _
"Client : " & Range("E3").Offset(Arg2, -2) & _
vbCrLf & "Marge : " & _
FormatPercent(Range("E3").Offset(Arg2, 0), 2)
.Left = x - (x * 0.4)
.Top = y - (y * 0.4)
End With
End If
End Sub
bonne soirée
michel