+ Reply to Thread
Results 1 to 8 of 8

Create a List of All Shapes

Hybrid View

  1. #1
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Create a List of All Shapes

    Hi all,

    How can I make a list of all the shapes I have created in my workbook. There are a couple that I made, stopped using, but never deleted and I don't want them within the workbook anymore.

    Regards:
    Last edited by Mordred; 09-30-2011 at 08:06 PM.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Wink Re: Create a List of All Shapes

    Hi Mordred,

    That is a very good question. Had the same problem many moons ago, but my pc packed up and I was rid of the problem. However, Leith Ross never seizes to amaze me with his programming skills and knowledge ! I am sure he wont mind if you ask him for help. I too, would like to see how it can be resolved. Good Luck!

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Create a List of All Shapes

    Sub x()
        Dim wks As Worksheet
        Dim shp As Shape
        
        For Each wks In Worksheets
            For Each shp In wks.Shapes
                Debug.Print shp.Name
            Next shp
        Next wks
    End Sub
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Create a List of All Shapes

    If the goal is to delete them, a slight expansion on SHG's macro can offer you that opportunity:

    Sub x()
    Dim wks As Worksheet
    Dim shp As Shape
        
        For Each wks In Worksheets
            For Each shp In wks.Shapes
                If MsgBox("Sheet " & wks.Name & " has a shape called '" & shp.Name _
                    & "', delete it?", vbYesNo, "Shape Found") = vbYes Then shp.Delete
            Next shp
        Next wks
    
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Create a List of All Shapes

    Wow,

    An excellent sample of the KISS principle. This Forum Rocks! Keep it up guys!

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Create a List of All Shapes

    A slight change to JB's code will let you see what you may be deleting:
    Sub x()
        Dim wks         As Worksheet
        Dim shp         As Shape
    
        For Each wks In Worksheets
            wks.Select
    
            For Each shp In wks.Shapes
                shp.Select
    
                If MsgBox(Title:="Whee!", _
                          Prompt:="Delete """ & shp.Name & """?", _
                          Buttons:=vbYesNo) = vbYes Then
                    shp.Delete
                    DoEvents
                End If
            Next shp
        Next wks
    End Sub

  7. #7
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Create a List of All Shapes

    Thanks for the help guys, shg's amendment of Jerry's procedure is a keeper!

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Create a List of All Shapes

    for a vba approach you can use the selection pane.
    Home > Editing > Find & Select > Selection Pane.

    You can use CTRL+Click to multi select and then delete.
    Cheers
    Andy
    www.andypope.info

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1