I'm using the following code in conjunction with an embedded chart to find the row where a specified value is located and use that value in a custom tooltip. The problem is that when this runs it deselects the chart and goes back to the last selected cell, and you have to click on the chart again to continue, which I don't want. Does anyone know a way to do this without using Find, or how to prevent Find from deselecting the chart? I'm working in Excel 2010.
Code:
Function FindTheRow(Rng As Range, sToFind As String) As Long
FindTheRow = Rng.Cells.Find(What:=sToFind, _
After:=Rng.Cells(1), _
lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
End Function