If you only want to delete unlocked pictures try -
Dim pic As Picture
For Each pic In ActiveSheet.Pictures
If Not pic.Locked Then
pic.Delete
End If
Next
Note typically objects, such as inserted pictures, are locked by default.
Regards,
Peter T
"Corey" <(E-Mail Removed)> wrote in message
news:erMZD$(E-Mail Removed)...
> Got it.
>
> Used:
>
> Sub Remove_Images()
> Application.ScreenUpdating = False
> Sheet1.Select
> Dim DrObj
> Dim Pict
> Set DrObj = ActiveSheet.DrawingObjects
> For Each Pict In DrObj
> If Pict.Locked = False Then
> Pict.Select
> Pict.Delete
> End If
> Next
> Application.ScreenUpdating = True
> End Sub
>
>
> "Corey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The below code is being used to remove any values from all cells that are
not locked.
>
> But i want to add a line to delete ALL pictures in the same sheet (Sheet1
= Layout Sheet) that are
> also NOT LOCKED.
>
> I have some logo's on the sheet that i have LOCKED, so i do NOT want these
deleted.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Sub Button72_Click()
> Application.DisplayAlerts = False
> ' Delete Unlocked Pictures code here
> '
> '
> ' Then clear cell contents that are Unlocked
> With Sheet1
> .Select
> .Unprotect
> Dim c As Range
> For Each c In Sheets("Layout Sheet").UsedRange
> If c.Locked = False Then
> c.Value = ""
> End If
> Next
> .Protect
> End With
> ActiveWorkbook.Save
> ActiveWorkbook.Close
> Application.DisplayAlerts = True
> End Sub
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Can anyone help?
>
> Corey....
>
>
>
|