Solved

Excel 2013 - iterate through selected Shapes

Posted on 2015-01-17
4
304 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 10

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
macro for finding text and replacing 7 43
Remove row and column 3 45
Hiding column macro 10 28
Why doesn't duplicate values work on this spreadsheet? 6 31
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 briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

919 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

14 Experts available now in Live!

Get 1:1 Help Now