Solved

I would like to delete all images in an excel  worksheet

Posted on 2011-03-08
11
238 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
  • 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
 

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now