Solved

I would like to delete all images in an excel  worksheet

Posted on 2011-03-08
11
244 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
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!

 

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

724 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