Identify Shapes

B

bw

I recorded a macro and it came up with the following line (among others):
ActiveSheet.Shapes("Button 25").Select

Assuming I have multiple shapes (Buttons) on my worksheet, How do I
determine the name of each Shape ("Button 25" in this case)?
 
J

JE McGimpsey

One way:

Select the button. Look in the Name box on the left side of the Formula
bar.
 
L

Les Stout

Hi bw, try the following, it will put the names in column A
Sub test()
'
Dim mySh As Shape
For Each mySh In ActiveSheet.Shapes
Cells(Rows.Count, 1).End(xlUp)(2).Value = mySh.Name
Next mySh
End Sub


Best regards,

Les Stout
 
G

Guest

Sub shhapes()
n = ActiveSheet.Shapes.Count
For i = 1 To n
MsgBox (ActiveSheet.Shapes(i).Name)
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top