Hi,
I know how to delete one image that I see in a worksheet, but how can I manage to delete all images on a worksheet, knowing that I don't know how many there are and what their number are?
Jungix
Hi,
I know how to delete one image that I see in a worksheet, but how can I manage to delete all images on a worksheet, knowing that I don't know how many there are and what their number are?
Jungix
You need to be careful
Sub DeleteShapes() Dim oShape As Shape Dim sTest As String Dim OKToDelete As Boolean For Each oShape In ActiveSheet.Shapes OKToDelete = True sTest = "" On Error Resume Next sTest = oShape.TopLeftCell.Address On Error GoTo 0 If oShape.Type = msoFormControl Then If oShape.FormControlType = xlDropDown Then If sTest = "" Then 'keep it OKToDelete = False End If End If End If If OKToDelete Then oShape.Delete End If Next shp End Sub
Thanks, with Next oShape it worked on my sample.
Why did you say I should be careful? What is your sTest doing?
Because the easy way is to goOriginally Posted by jungix
For Each oShape In ActiveSheet.Shapes oShape.Delete Next oShape
but the problem here is that it also removes the Data Validation dropdown and the Autofilter dropdown, and there is no way to get them back. I developed the convoluted method shown previously to avoid this.
Originally Posted by xld
That's a pretty significant issue!
Regards,
Patrick
I wept for myself because I had no PivotTable.
Then I met a man who had no AutoFilter.
Microsoft MVP for Excel, 2007 & 2008
Slight correction, you can re-create the autofilter which will restore that arrow, that's a pain but it can be done, but I know of no way to get the DV arrow back. The even worse part of that is that it is gone from the sheet, thaht is if you create a new List DV on that sheet, it too will not have an arrow.Originally Posted by matthewspatrick