find the sheet of an active chart (VBA)

C

Chris

Is there anyway to find the name of the sheet which contains an active chart
using VBA (Excel)?
I want to be able to select the plot and run a macro which set the scales
.... resizes the plot area and then the chart area . I can do everything I
want excpet resize the plot area because I dont know how to find the current
sheet name. Is there any way to find the current sheet name or resize the
plot area without the current sheet name?

Thanks

Chris
 
J

JE McGimpsey

One way:

With ActiveChart.PlotArea
.Width = 400
.Height = 300
End With

If you want to get the parent worksheet:

Dim ws As Worksheet
If Not ActiveChart Is Nothing Then _
Set ws = ActiveChart.Parent.Parent
 

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