Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

Proud member of

PPTools

Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

Invert the current selection: select all unselected shapes

Problem

It's simple to select one or two shapes on a slide, but what if you need to select a complicated group of shapes?

Sometimes it's simpler to select the shapes you don't want and tell PowerPoint "Invert the selection".

Or it would be, but PowerPoint doesn't have a handy command like this. So we wrote a bit of VBA to give it one.

Solution

This code will unselect everything that's selected, then select everything that wasn't selected. Invert the current selection, in other words.

Sub InvertSelection()
' Invert current selection
' Anything that's selected gets unselected
' Anything that's unselected gets selected

    Dim x As Long
    Dim oSh As Shape

    ' Test: IS there a current selection?
    On Error Resume Next
    If ActiveWindow.Selection.ShapeRange.Count = 0 Then
        MsgBox "Please select one or more shapes on the current slide, then try again."
        Exit Sub
    End If

    ' Record current selection
    For Each oSh In ActiveWindow.Selection.ShapeRange
        Call oSh.Tags.Add("Sel", "Y")
    Next

    ' deselect everything
    ActiveWindow.Selection.Unselect

    ' select everything, filtering out previously selected items
    For Each oSh In ActiveWindow.Selection.SlideRange.Shapes
        If Len(oSh.Tags("Sel")) = 0 Then
            ' add it to the selection
            oSh.Select (msoFalse)
        Else
            ' clear the tag
            oSh.Tags.Delete ("Sel")
        End If
    Next

End Sub


Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2022 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Invert the current selection: select all unselected shapes
http://www.pptfaq.com/FAQ00887_Invert_the_current_selection-_select_all_unselected_shapes.htm
Last update 07 June, 2011
Created: