if chart exists, remove it

shew0387

New Member
Joined
Jan 13, 2005
Messages
14
I'm trying to update charts by hitting a button I've made in the wkst, so if there is new data, it will remove the old chart, and replace it with a new chart of the same name - all the charting works properly, but the following code only removes the chart if it already present...but doesn't work if there isn't a chart there already -- If there is no chart by that name, I'd like to skip the code and continue with the rest of my code that creates the chart...

ActiveSheet.ChartObjects("Crack_location_length").Activate
ActiveChart.ChartArea.Select
ActiveWindow.Visible = False
Selection.Delete
Range("N6").Select
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,203,082
Messages
6,053,418
Members
444,662
Latest member
AaronPMH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top