How To Delete All Pictures In A Range Of Cells ?


You may quickly add images to cells in Excel to improve the aesthetic appeal of your spreadsheets. However, handling these photographs might take a lot of time, especially if you need to delete a lot of them. Fortunately, Excel has strong tools and functions that can be used to automate monotonous operations and improve workflow. In this tutorial, we'll show you step−by−step how to remove all images from an Excel range of cells that you choose. This video will show you how to remove the photographs effectively without having to delete them one at a time, whether you unintentionally added a lot of images or you simply need to clean up your spreadsheet.

By the end of this article, you should be able to use Excel's built−in tools to delete images from a selection of cells, saving you a lot of time and work. So let's begin and discover how to erase all images from a set of cells in Excel!

Delete All Pictures In A Range Of Cells

Here, we will first create a VBA module and then run it to complete the task. So let us see a simple process to know how you can delete all pictures in a range of cells in Excel.

Step 1

Consider an Excel sheet where you have pictures similar to the below image.

First, right−click on the sheet name and select View Code to open the VBA application, then click on Insert and select Module, then copy the below−mentioned code into the text box as shown in the below image.

Right click > View code > Insert > Module > Copy.

Code

Sub DeletePic()
   Dim xPicRg As Range
   Dim xPic As Picture
   Dim xRg As Range
   Application.ScreenUpdating = False
   Set xRg = Range("A1:C6")
   For Each xPic In ActiveSheet.Pictures
      Set xPicRg = Range(xPic.TopLeftCell.Address & ":" & xPic.BottomRightCell.Address)
      If Not Intersect(xRg, xPicRg) Is Nothing Then xPic.Delete
   Next
   Application.ScreenUpdating = True
End Sub

Step 2

Then save the sheet as a macro−enabled template and click F5 to run the module, and all the images in the specified range will be deleted.

Save > F5.

Conclusion

In this tutorial, we have used a simple example to demonstrate how you can delete all pictures in a range of cells in Excel.

Updated on: 07-Jul-2023

300 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements