Thread: delete a shape
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
James James is offline
external usenet poster
 
Posts: 542
Default delete a shape

probably a quick and easy question but I cannot seem to figure it out. here
goes

I have a button that inserts a copy of a shape into the active cell when
clicked. what I want to do is delete the existing shape if one exists (in
that activecell) and paste in the new one. here is my code. thanks for any
help. much appreciated.

Private Sub CommandButton2_Click()
'check for existing shape in activecell - If one exists then delete, if not
continue
ActiveSheet.Shapes("Picture 1").Select
Selection.Copy
ActiveCell.Select
ActiveSheet.Paste
Selection.ShapeRange.IncrementTop 10
Selection.ShapeRange.IncrementLeft -2
ActiveCell.Value = 1
ActiveCell.Next.Select
End Sub