how can I delete images in an specific column? using vba

Digitalización Chambi 1 Reputation point
2022-09-23T20:31:42.82+00:00

I'm using this code:

Sub delete()     
     
For Each shp In ActiveSheet.Shapes     
        shp.delete     
Next     
     
End Sub     
     

Can I change this code or do I need to use another code?

Developer technologies | Visual Basic for Applications
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dillon Silzer 57,831 Reputation points Volunteer Moderator
    2022-09-23T22:10:49.967+00:00

    Hi @Digitalización Chambi

    Please see the following from https://forum.ozgrid.com/forum/index.php?thread/1228094-delete-shapes-in-specific-column/ (answered by jolivanes)

    Sub Maybe()  
    Dim ws As Worksheet, shp As Shape  
    Set ws = ActiveSheet    '<---- Change to proper sheet name if so desired  
    For Each shp In ws.Shapes  
    If Not Intersect(shp.TopLeftCell, Range("A2:C100")) Is Nothing Then shp.Delete  
    Next shp  
    End Sub  
    

    Change your range in the code above.

    ------------------------------

    If this is helpful please accept answer.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.