View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default How to delete an embedded chart

Dim ws As Worksheet
Dim chObj As ChartObject
Set ws = ActiveSheet
ws.unprotect
For Each chObj In ActiveSheet.ChartObjects
chobj.Delete
Next chObj
ws.protect

--
Regards,
Tom Ogilvy


Tina wrote in message
om...
Hi,
I am trying to delete an embedded chart from a protected sheet. But i
am getting errors like "select method of chartarea class failed". Can
anyone help?
Here is the code:

Dim ws As Worksheet
Dim chObj As ChartObject
Set ws = ActiveSheet
For Each chObj In ActiveSheet.ChartObjects
chObj.Chart.ChartArea.Select '*** error here
ActiveWindow.Visible = False
Selection.Delete
Next chObj


Thanks
Gunjan Salgia