Delete all Pictures in a workbook
This tutorial shows how to delete only pictures from an entire workbook at once through the use of VBA
METHOD 1. Delete all Pictures in a workbook
VBA
Sub Delete_Pictures()
'declare variables
Dim ws As Worksheet
Dim Pic As Object
Dim ws As Worksheet
Dim Pic As Object
For Each ws In ThisWorkbook.Worksheets
ws.Activate
For Each Pic In ws.Pictures
Pic.Delete
Next Pic
Next ws
End Sub
ADDITIONAL NOTES
Note 1: This macro will loop through every worksheet in the workbook in which the VBA code is written in and delete all pictures.
Note 1: This macro will loop through every worksheet in the workbook in which the VBA code is written in and delete all pictures.
EXPLANATION
This tutorial shows how to remove only pictures an entire workbook at once by using VBA. The macro in this example uses ThisWorkbook to identify in which workbook to delete the pictures, which means that the macro will delete all the pictures in the workbook in which the VBA code is written in.
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
Delete all Pictures in a sheet | How to delete only pictures in a specific sheet at once | |
Delete all Pictures and Objects in a workbook | How to delete all pictures and objects from an entire workbook at once | |
Assign a macro to a button | How to assign a macro to a Form Control and ActiveX Control button |