+ Reply to Thread
Results 1 to 4 of 4

VBA Delete Shapes that Do Not Have Connections

Hybrid View

ChrisHook VBA Delete Shapes that Do Not... 07-03-2019, 11:55 AM
dangelor Re: VBA Delete Shapes that Do... 07-03-2019, 01:06 PM
ChrisHook Re: VBA Delete Shapes that Do... 07-03-2019, 02:28 PM
dangelor Re: VBA Delete Shapes that Do... 07-03-2019, 04:07 PM
  1. #1
    Registered User
    Join Date
    10-14-2015
    Location
    East Coast
    MS-Off Ver
    2013
    Posts
    69

    VBA Delete Shapes that Do Not Have Connections

    All,

    I have a worksheet that includes a number of shapes connected by connectors. I'd like to write a macro that deletes all shapes that do not have connectors connected to them (long story).

    Any idea on how to accomplish this?

    Best,
    Chris

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,310

    Re: VBA Delete Shapes that Do Not Have Connections

    Possibly... (not tested)
    Sub DeleteConnector()
        Dim sh As Shape
        
        For Each sh In ActiveSheet.Shapes
            If sh.Connector Then
                If Not sh.ConnectorFormat.BeginConnected Then
                    sh.Delete
                End If
            End If
        Next
    End Sub

  3. #3
    Registered User
    Join Date
    10-14-2015
    Location
    East Coast
    MS-Off Ver
    2013
    Posts
    69

    Re: VBA Delete Shapes that Do Not Have Connections

    Thanks, Dangelor - worked perfectly

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,310

    Re: VBA Delete Shapes that Do Not Have Connections

    Thanks for letting me know! Never dealt with that aspect of Excel before.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how to delete a shapes
    By glda19 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-14-2018, 10:41 AM
  2. [SOLVED] Delete Unnecessary Data Connections
    By excellenthelp in forum Excel General
    Replies: 3
    Last Post: 02-01-2016, 12:02 PM
  3. [SOLVED] Delete all data connections in Word document
    By Pida in forum Word Programming / VBA / Macros
    Replies: 6
    Last Post: 08-14-2015, 09:58 AM
  4. Is the only way to 'close' an ActiveWorkbook.Connections to delete it?
    By trgz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-08-2015, 09:46 AM
  5. Cannot delete data connections
    By dpenny in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-21-2011, 05:51 PM
  6. Delete Connections Code Not Working
    By SDruley in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-01-2009, 11:07 AM
  7. Replies: 1
    Last Post: 06-09-2009, 03:15 PM

Tags for this Thread

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