An excel cell 'contains' a jpg shape. When I duplicate that cell how do I get the shape name for the newly duplicated shape?

My Worksheet contains a row of cells in which different shapes have been added to some (not all)  specific columns. (Their purpose is that clicking each shape provides access to different vba procedures).

Some cells in the row contain comments, but cells with an added shapes do NOT contain comments

Shapes are added via excel Shapes.AddPicture Method

When a Shape is added to a cell, Shape.name (eg 'Picture16') is recorded to enable control of visibility, and shape deletion.

Now I copy the row of shapes to a new row on the same sheet. How do I enumerate the shapes collection to obtain the shape.names for each identified cell that contains a newly copied shape?

Thanks
Kelvin
Kelvin4Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try

Sub Macro()
Set newRow = Range("4:4")
For Each shp In ActiveSheet.Shapes
    If Not Intersect(newRow, shp.TopLeftCell) Is Nothing Then
        MsgBox shp.Name
    End If
Next
End Sub

Open in new window

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kelvin4Author Commented:
Thanks, Rgonzo:
I'll work on this by tomorrow
Kelvin
0
Martin LissOlder than dirtCommented:
If you are interested in the name of the last shape added you don't need to iterate through them but rather just do something like LastShapeName = ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Name.
0
Kelvin4Author Commented:
Thanks for rapidly and completely solving my question, and for taking the trouble to expand my knowledge.
Regards, Kelvin
0
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.