Identify Excel Shape Types with VBA Without Selecting Shapes
Question details
Identify the names and types of worksheet shapes with VBA without selecting each shape.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user wants to inspect the shapes on a worksheet programmatically.
- Observed behavior
- The desired result is a list of shape properties obtained directly from the worksheet's Shapes collection.
Open the workbook in a version of Excel that supports VBA and activate the worksheet containing the shapes. Make sure macros are enabled according to your organization's security settings.
Read Shape Properties from the Worksheet Shapes Collection
Loop through the active worksheet's shapes and print their properties without selecting them.
The Shape object exposes Name and Type directly. Check that a shape is an AutoShape before reading its AutoShapeType property.
In Excel, open the Developer tab and select Visual Basic.
In the VBA editor, choose Insert > Module and paste: Sub ListShapeTypes() Dim shapeItem As Shape For Each shapeItem In ActiveSheet.Shapes If shapeItem.Type = msoAutoShape Then Debug.Print shapeItem.Name, shapeItem.Type, shapeItem.AutoShapeType Else Debug.Print shapeItem.Name, shapeItem.Type End If Next shapeItem End Sub
Choose View > Immediate Window, place the cursor inside ListShapeTypes, and press F5. Read the names and type values in the Immediate window.

Work with Spreadsheet Shapes in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for common Excel formats, making it easy to move everyday workbook editing between suites. Test any VBA-dependent workbook separately before relying on its macros in WPS.

Frequently Asked Questions
Can I inspect a shape without selecting it?
Yes. Loop through ActiveSheet.Shapes and read each Shape object's Name and Type properties directly.
How can I tell whether a shape is a rectangle?
First check that shapeItem.Type equals msoAutoShape, then check whether shapeItem.AutoShapeType equals msoShapeRectangle.
Where does Debug.Print display the results?
In the VBA editor, choose View > Immediate Window. Run the macro and read the printed shape properties there.
Will this loop list shapes inside a group individually?
The worksheet Shapes collection includes the group as a shape. To inspect individual members, access the group's GroupItems collection and loop through its items.




