ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find the sheet of an active chart (VBA) (https://www.excelbanter.com/excel-programming/395967-find-sheet-active-chart-vba.html)

Chris

find the sheet of an active chart (VBA)
 
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

Gary Keramidas

find the sheet of an active chart (VBA)
 
activesheet.name doesn't give it to you?

--


Gary


"Chris" wrote in message
...
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




JE McGimpsey

find the sheet of an active chart (VBA)
 
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


In article ,
Chris wrote:

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



All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com