• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

I would like to delete all images in an excel worksheet

I have images in a worksheet that I would like to delete in one shot.  The images are in cells
A6 to L1000.
0
dmalovich
Asked:
dmalovich
  • 4
  • 4
  • 2
  • +1
1 Solution
 
TracyVBA DeveloperCommented:
- Select cells Ag:L1000
- Press Ctrl + G and click Special
- Select Objects then click OK
- Press delete on your keyboard
0
 
akajohnCommented:
Backup all files as usual!
0
 
TonyWongCommented:
Simplest way is to drag selection box over the images and then hit the 'Delete' button.
I would advise to save the workbook before doing this though, just in case.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
dmalovichAuthor Commented:
How can this be done in a macro using vba?
0
 
TracyVBA DeveloperCommented:
Try this:

Sub DeleteObjects()
    ActiveSheet.DrawingObjects.Delete
End Sub

Open in new window

0
 
dmalovichAuthor Commented:
That deleted all objects.  I just wanted objects deleted in cells A6 to L1000
0
 
TonyWongCommented:
That deleted all objects.  I just wanted objects deleted...

Please clarify as this quote is contradictory....
0
 
dmalovichAuthor Commented:
the vba macro deleted all objects on the sheet, even if they were in cell a1.  I would like to delete
all objects that are in cells A6 to L1000 range.
0
 
TracyVBA DeveloperCommented:
Have a look here:

http://p2p.wrox.com/pro-vb-6/47491-clearing-drawing-objects-given-excel-range.html
Sub testit()
WipeOffRng Selection
End Sub

Sub WipeOffRng(WipeRange As Range)
Dim isect As Range
Dim wkSheet As Worksheet
Dim Shp As Shape
Dim rngShp As Range

    ' Set the worksheet
    Set wkSheet = WipeRange.Parent

    ' Loop through every shape
    For Each Shp In wkSheet.Shapes

        ' Dtermine the block range
        Set rngShp = Range(Shp.TopLeftCell, Shp.BottomRightCell)

        ' Test for any sort of overlap
        'If Not Intersect(WipeRange, rngShp) Is Nothing Then
        ' Test for fully inside

        Set isect = Intersect(WipeRange, rngShp)
        If isect Is Nothing Then

            Else
            Shp.Delete

        End If

    Next Shp

End Sub

Open in new window

0
 
TracyVBA DeveloperCommented:
If you don't want to select the range before hand, then modify this:
Sub testit()
WipeOffRng Selection
End Sub

to this:

Sub testit()
WipeOffRng Range("A6:L1000")
End Sub
0
 
dmalovichAuthor Commented:
Thanks.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now