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 a chart using code?

if you have multiple charts:

Dim chartobj as ChartObject
for each chartobj in ActiveSheet.ChartObjects
if chartObj.TopLeftCell.Address = "$B$9" then
chartObj.Delete
end if
Next

If only one
activesheet.ChartObjects(1).Delete

--
Regards,
Tom Ogilvy

"pwermuth" wrote in
message ...

How do I delete a chart for which I do not have a name but only the cell
the chart is anchored in using code?

I.e. when I created the chart I pasted in in a cell. Now I want to be
able to delete it by somehow referring to the cell I pasted it into.


--
pwermuth
------------------------------------------------------------------------
pwermuth's Profile:

http://www.excelforum.com/member.php...o&userid=24997
View this thread: http://www.excelforum.com/showthread...hreadid=386319