Written by Allen Wyatt (last updated August 2, 2025)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365
Theresa inherited a large number of workbooks, each including quite a few pictures. She needs to delete the pictures, but doing so one at a time is rather tedious. Theresa wonders if there is a way to open a workbook and quickly delete all the pictures rather than selecting them one at a time.
There are a couple of ways you can approach this task. One way to accomplish it is to follow these steps:
Another way to do this is to click on one of the pictures so it is selected (handles appear around it), and then press Ctrl+A. That selects all the pictures and you can press the Delete key.
There are few major caveats to using this method of selecting and deleting. First, it works only in the currently active worksheet. Theresa wanted to delete all the pictures in the workbook, which means she would need to repeat these steps for each worksheet. Second, note that you are selecting objects, which is not limited to pictures. If the worksheet contains other objects such as shapes and embedded charts, those are selected (and subsequently deleted) as well.
Even if you only have pictures on the worksheet, deleting them using these steps only relieves some of the tedium that Theresa notes. A good way to remove the tedium is to use a macro to do the deletions. This macro will delete all the pictures on all worksheets in the current workbook.
Sub DeleteWorkbookPictures1() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets ws.Pictures.Delete Next ws End Sub
Notice that the macro uses the Pictures collection. Documentation on this collection is spotty, at best, and it is not clear whether Microsoft officially recommends its use. What is clear is that each worksheet has a Pictures collection, and that collection is a subset of the larger Shapes collection.
This means that you could rewrite the macro to utilize the Shapes collection, if you prefer to stick to "official" collections. Here is a macro that does the exact same thing as the previous one:
Sub DeleteWorkbookPictures2() Dim ws As Worksheet Dim shp As Shape For Each ws In ActiveWorkbook.Worksheets For Each shp In ws.Shapes If shp.Type = msoPicture Then shp.Delete Next Next ws End Sub
The macro steps through the Shapes collection on each worksheet and checks the .Type property of the shape. If the shape is a picture (msoPicture), then the shape is deleted.
If you want even more automation in the macro, you can step through all the workbooks in a folder and delete all the pictures. Here's how to accomplish the task:
Sub Delete_All_Pics_In_Folder() Dim sPath As String Dim sFile As String Dim wb As Workbook Dim ws As Worksheet Dim shp As Shape Dim sMsg As String Dim iCount As String sPath = "C:\YourFolderPath\" sMsg = "" sFile = Dir(sPath & "*.xls*") Do While sFile <> "" Set wb = Workbooks.Open(sPath & sFile) iCount = 0 For Each ws In wb.Worksheets For Each shp In ws.Shapes If shp.Type = msoPicture Then shp.Delete iCount = iCount + 1 End If Next shp Next ws wb.Close SaveChanges:=True If iCount > 0 Then sMsg = sMsg & "Deleted " & iCount & " pictures in " & sFile & vbCr End If sFile = Dir Loop MsgBox sMsg End Sub
The key to making this macro work is to copy all the workbooks you want to process into a single folder. Then, change sPath so that it contains the full path to the folder. It is very important that the path end with a backslash. The macro then uses the Dir function to return the names of each workbook in the folder. (A workbook, for this macro, is defined as any file that uses an extension that begins with .xls.)
The macro opens the workbooks, steps through each worksheet, checks each member of the Shapes collection, and deletes the shape if it is a picture. When all the worksheets in a workbook have been processed, the macro then saves the workbook and moves on to the next one. When all the workbooks have been processed, then the macro displays a message telling how many pictures were deleted in each workbook.
There is one other non-macro approach that should be mentioned before finishing out. If you prefer to not delete the pictures, you could simply hide them. This is done by configuring Excel to hide them, as discussed in this ExcelTip:
https://tips.net/T6124
The pictures remain in the workbook, they are simply hidden from view.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13949) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365.
Program Successfully in Excel! This guide will provide you with all the information you need to automate any task in Excel and save time and effort. Learn how to extend Excel's functionality with VBA to create solutions not possible with the standard features. Includes latest information for Excel 2024 and Microsoft 365. Check out Mastering Excel VBA Programming today!
Excel allows you to capture portions of your worksheet as a picture that you can then use in a variety of other ways. ...
Discover MoreExcel makes it easy to place a graphic in a worksheet. Once there, you may want to chop off a side (or two) of the ...
Discover MoreDo you need to add a logo or other graphic to a bunch of worksheets? Here are a couple of short macros that can make ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2025-08-05 21:39:51
Francisco de Jesus Orozco Rioz
TYPO: "(A workbook, for this macro, is defined as any file that uses an extension that begins with .xls.)" should say "(A workbook, for this macro, is defined as any file that uses an extension that ends with .xls.)". In any case, the glob expression '*.xls*' selects the file if the text appears in any part of the filename, like 'budget_report.xls.docx'.
2025-08-04 10:13:16
J. Woolley
The Tip's 2nd and 3rd macros use the shp.Delete method to delete shapes of Type msoPicture. Instead of deleting them, you could hide them by replacing shp.Delete with the following:
shp.Visible = False
Pictures hidden in this way can be unhidden by repeating the macro with
shp.Visible = True
or by using the Selection Pane as described in my previous comment below.
2025-08-02 14:59:09
J. Woolley
The Tip mentions hiding pictures instead of deleting them as described here: https://tips.net/T6124
Actually that Tip describes the option to hide all drawing objects, not just pictures, in a currently open workbook; once the option is set it applies to the specified workbook only and is retained when that workbook is saved. Notice drawing objects (a.k.a. Shape objects) include the following: Picture, Chart, Freeform, AutoShape, OLE object, etc.
The following macro will toggle (hide/show) display of all drawing objects in the active workbook; this setting is equivalent to the option described above and is retained when the workbook is saved:
Sub ToggleHideShapes()
With ActiveWorkbook
.DisplayDrawingObjects = IIf(.DisplayDrawingObjects = xlHide, _
xlDisplayShapes, xlHide)
End With
End Sub
In case you never noticed, the Editing group of the Home tab includes
Find & Select > Selection Pane (Alt+H, ZE, FD, P). This opens a new pane listing all shapes on the active sheet. Each shape's name identifies its type unless you have renamed the shape. You can hide/show individual shapes or all shapes, but only on the active sheet. These settings are retained when the workbook is saved; they are independent of the workbook’s DisplayDrawingObjects property described above.
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments