Mouse over effect on autoshape

M

Mark Stephens

The line chart hilite effect is really great (especially on a black
bacground, thanks Andy ). http://www.pdbook.com/index.php/excel/comment/635/

Does anyone know how one would modify it so that you for example have an
autoshape the same colour as the line on the chart and when you mouse
over it it lights up (hilites, it really is a great effect) the line on the
chart?

The other effect I would really love to achieve is a similar effect with the
pie chart where when you mouse over a slice, it's border hilites in the same
way as the line on the line chart.

Thanks again, kind regards, Mark
 
J

Jon Peltier

Mark -

In the first chart, name the shapes "shpSeries1", "shpSeries2" etc. This is the
framework for the code you want:

Private Sub Chart_MouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal x As
Long, ByVal y As Long)
Dim ElementID As Long, Arg1 As Long, Arg2 As Long

GetChartElement x, y, ElementID, Arg1, Arg2

Application.StatusBar = ElementID & ", " & Arg1 & ", " & Arg2

If ElementID = xlShape Then
If Left(ActiveChart.Shapes(Arg1).Name, 9) = "shpSeries" Then
With ActiveChart.SeriesCollection _
(CLng(Mid(ActiveChart.Shapes(Arg1).Name, 10)))

' change color etc.

End With
End If

End If

End Sub


For the pie chart, you are changing the border formatting. Andy's effect that
changes the data in a second line chart series so it now appears won't work with the
pie, but my approach that changes the connecting line format can be modified. Record
a macro while you change the formatting of a pie slice to see the syntax.

Note that you need to know which point you are mousing over, so you need to use Arg2
(point number) as well as Arg1 (series number).

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top