View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Problem - Deleting a Picture from a Cell

You are starting with an incorrect perception. Pictures are on a different
layer than cells. They may sit over a cell, but they are not in the cell.
You would need to loop and find the picture

Sub DeletePicture()
Dim pic As OLEObject
For Each pic In ActiveSheet.Pictures
If pic.TopLeftCell.Address = _
Cells(10, 1).Address Then
pic.Delete
End If
Next
End Sub

--
Regards,
Tom Ogilvy



general zod wrote in message
...

I have inserted a small picture (jpg) into cell (a1)


and I have used the following excel 97 VBA code to copy that picture
into cell a10


Cells(1, 1).Select

Cells(1, 1).CopyPicture

Cells(10, 1).PasteSpecial


Does anyone know the VBA code to then delete the picture from cell
(10,1) A10 ????

Cells(10,1).delete just deletes the cell , it leaves the picture
there ?


.