Here is the code to insert on the Chart1 object code window.
Dim keepA As Long, keepB As Long
Private Sub Chart_MouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)
Dim ws1 As Worksheet, ws2 As Worksheet
Dim searchModel As Range, searchColor As Range
Dim searchComment As Range, lastRow As Long
Dim ID As Long, a As Long, b As Long
Me.GetChartElement x, y, ID, a, b
If a = keepA And b = keepB Then Exit Sub
Select Case ID
Case 3
Set ws1 = Sheet2
myColor = ws1.Cells(4, a + 1)
myModel = ws1.Cells(b + 4, 1)
Set ws2 = Sheet3
lastRow = ws2.Cells.SpecialCells(xlLastCell).Row
Set searchModel = Range(ws2.Cells(1, 1), ws2.Cells(lastRow, 1))
Set searchColor = Range(ws2.Cells(1, 2), ws2.Cells(lastRow, 2))
Set searchComment = Range(ws2.Cells(1, 5), ws2.Cells(lastRow, 5))
'MsgBox myColor, vbOKOnly, myModel
For i = 1 To lastRow
If searchModel.Cells(i) = myModel Then
If searchColor.Cells(i) = myColor Then
MsgBox searchComment.Cells(i)
Exit For
End If
End If
Next i
keepA = a
keepB = b
Case Else
'do nothing
End Select
End Sub
keepA and keepB are declared outside of the Event procedure so that you do not get the message box again until you mouse over a different model or different color.
You would want to replace the MsgBox with something more elaborate, I assume.
Bookmarks