Solved

I would like to delete all images in an excel  worksheet

Posted on 2011-03-08
11
243 Views
Last Modified: 2012-05-11
I have images in a worksheet that I would like to delete in one shot.  The images are in cells
A6 to L1000.
0
Comment
Question by:dmalovich
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 24

Expert Comment

by:broomee9
ID: 35070110
- Select cells Ag:L1000
- Press Ctrl + G and click Special
- Select Objects then click OK
- Press delete on your keyboard
0
 
LVL 6

Expert Comment

by:akajohn
ID: 35070129
Backup all files as usual!
0
 
LVL 1

Expert Comment

by:TonyWong
ID: 35070141
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
Industry Leaders: 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!

 

Author Comment

by:dmalovich
ID: 35070240
How can this be done in a macro using vba?
0
 
LVL 24

Expert Comment

by:broomee9
ID: 35070263
Try this:

Sub DeleteObjects()
    ActiveSheet.DrawingObjects.Delete
End Sub

Open in new window

0
 

Author Comment

by:dmalovich
ID: 35070462
That deleted all objects.  I just wanted objects deleted in cells A6 to L1000
0
 
LVL 1

Expert Comment

by:TonyWong
ID: 35070590
That deleted all objects.  I just wanted objects deleted...

Please clarify as this quote is contradictory....
0
 

Author Comment

by:dmalovich
ID: 35070613
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
 
LVL 24

Accepted Solution

by:
broomee9 earned 500 total points
ID: 35070632
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
 
LVL 24

Expert Comment

by:broomee9
ID: 35070657
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
 

Author Closing Comment

by:dmalovich
ID: 35070755
Thanks.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question