Results 1 to 5 of 5

delete all pictures in a worksheet

This is a discussion on delete all pictures in a worksheet within the Excel Questions forums, part of the Question Forums category; How can I use vba do delete all the pictures in a worksheet? For example, when I copy and paste ...

  1. #1
    New Member
    Join Date
    Sep 2008
    Posts
    2

    Default delete all pictures in a worksheet

    How can I use vba do delete all the pictures in a worksheet? For example, when I copy and paste the table on this page:

    http://www.tsl.state.tx.us/apps/lrs/agencies/

    There are so many pictures it takes forever to do it manually.

  2. #2
    Board Regular
    Join Date
    Sep 2006
    Posts
    385

    Default Re: delete all pictures in a worksheet

    If you just want the first column of data, then copy the table and in Excel do a Paste Special Text. That will not paste the graphics or their associated links.

    Or if you do a paste with the graphics, open the Drawing toolbar and click the arrow (select tool). Then drag over all the pictures and press Delete.

  3. #3
    Board Regular XLXRider's Avatar
    Join Date
    Jul 2004
    Posts
    179

    Default Re: delete all pictures in a worksheet

    This one clears all objects (here, named as MWIICons) from a worksheet, with the exception of one named "CSALogo". Obviously, if you have one/some you want to keep, you could code it accordingly.
    Play with it, you'll get the hang of it in a minute!

    Regards,
    XLXRider

    Code:
    Sub ClearIcons()
    'ClearIcons from the active worksheet
       Dim ws As Worksheet
       For Each MWIIcon In ActiveSheet.Shapes
        Select Case MWIIcon.Name
            Case "CSALogo"  ' do nothing
        Case Else
          MWIIcon.Delete
         End Select
            Next MWIIcon
    End Sub
    "When you build an idiot-proof Worksheet, they'll build a better idiot."

  4. #4
    New Member
    Join Date
    Sep 2008
    Posts
    2

    Default Re: delete all pictures in a worksheet

    What is an MWIIcon? Is it always named that or is this some arbitrary name?

  5. #5
    Board Regular XLXRider's Avatar
    Join Date
    Jul 2004
    Posts
    179

    Default Re: MWIIcon

    Yes, it is an arbitrary name. I made a couple of toolbars called "MWI Icon" and "MWI Icon2" (Manufacturing Work Instructions) so decided to use - for lack of a better name! - MWIIcon to declare the objects. I did get most of the code from this board, and just modified it to suit my situation. Again, all I did was to grab the code, put up a test file, and mess around with it.

    HTH!

    Regards,
    XLXRider
    "When you build an idiot-proof Worksheet, they'll build a better idiot."

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com