Solved

Excel 2013 - iterate through selected Shapes

Posted on 2015-01-17
4
281 Views
Last Modified: 2015-01-22
I have number of Shapes selected programmaticallly on a single sheet. Now I'd like to iterate through those Shapes. What would be a good way to do that?
0
Comment
Question by:hindersaliva
  • 2
4 Comments
 

Author Comment

by:hindersaliva
ID: 40555363
I solved it by ...
Selection.Interior.Color = 192

I didn't need to iterate through the selected Shapes 'cos the above works. Seems pretty obvious!
0
 
LVL 85

Assisted Solution

by:Rory Archibald
Rory Archibald earned 250 total points
ID: 40557245
Even though you don't need it, since you asked:

    Dim shp As Shape
    
    If TypeName(Selection) = "DrawingObjects" Then
        For Each shp In Selection.ShapeRange
            Debug.Print shp.Name
        Next shp
    End If

Open in new window

0
 
LVL 9

Accepted Solution

by:
Jamie Garroch earned 250 total points
ID: 40557247
Just to answer the original question (in case another reader need to know how to do this), you can loop through all shapes in a selection like this:

Sub CheckShapes()
  Dim oShp As Shape
  
  For Each oShp In ActiveWindow.Selection.ShapeRange
    Debug.Print oShp.Name
  Next
End Sub

Open in new window

0
 

Author Closing Comment

by:hindersaliva
ID: 40564785
Thanks guys. I learned something new.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now