delete rows based on cells having a floating pix

G

GottaRun

Hi,

I have 2 columns. . What I want to do is to delete the rows where th
cells of column B has a picture of a magnifying glass. Autofilte
treted all the cells in B as blank.
zip file containing sample file attached.

thanks for any assist

+-------------------------------------------------------------------
|Filename: Book4.zip
|Download: http://www.excelforum.com/attachment.php?postid=4479
+-------------------------------------------------------------------
 
J

JE McGimpsey

I won't open your workbook, for many reasons, including potential virii.
However, this may work for you.

Pictures don't reside in a cell, they reside in the Drawing Layer on top
of cells. This macro will determine which pictures have the name
"magnifying_glass" in them, and delete both the pictures and the rows
that contain the cell over which the picture's top left corner lies.

Public Sub DeleteRowsWithMagnifyingGlasses()
Dim rDelete As Range
Dim picTest As Picture
For Each picTest In ActiveSheet.Pictures
With picTest
Debug.Print .Name
If LCase(.Name) Like "magnifying_glass*" Then
If rDelete Is Nothing Then
Set rDelete = .TopLeftCell
Else
Set rDelete = Union(rDelete, .TopLeftCell)
End If
.Delete
End If
End With
Next picTest
If Not rDelete Is Nothing Then _
rDelete.EntireRow.Delete
End Sub

Modify the picture names to suit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top