ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Checking to see that a CHART exists prior to running a simple command (https://www.excelbanter.com/excel-discussion-misc-queries/107451-checking-see-chart-exists-prior-running-simple-command.html)

Anton

Checking to see that a CHART exists prior to running a simple command
 
Hello All

Help!

I have been trying to work out a simple way to see whether a particular
chart is present on the ACTIVE WORKSHEET prior to running an IF ...
THEN statement. The basic code is below. I need the method to check
that Chart 3 exists or not. (There are 2 other charts on the
worksheet). If it exists, then based on the second criteria, it will
either delete the chart or adapt the scale of the chart to better fit
the data.

Can you help guru's?
-------------------------------

Lets call the Chart "3"

Sub UpdateScale_Chart()

IF <<<Here is where I need to add in the test THEN

<<< TERMINATE

ElseIf Worksheets("Data").Range("B34") < "CCSP" Then
ActiveSheet.ChartObjects("Chart 3").Delete

Else
ActiveSheet.ChartObjects("Chart 3").Activate
With ActiveChart.Axes(xlValue)
..MinimumScale = Range("Alpha!D73").Value
..MaximumScale = Range("Alpha!D74").Value

End With
End If
End Sub



All times are GMT +1. The time now is 02:43 PM.

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