ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Identify Shapes (https://www.excelbanter.com/excel-programming/395629-identify-shapes.html)

bw

Identify Shapes
 
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)?




JE McGimpsey

Identify Shapes
 
One way:

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

In article ,
"bw" wrote:

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)?


Les Stout[_2_]

Identify Shapes
 
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

*** Sent via Developersdex http://www.developersdex.com ***

bw

Identify Shapes
 
Thank you both, JE and Les!
And now I know...
Bernie

"bw" wrote in message
...
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)?






Gary''s Student

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

--
Gary''s Student - gsnu200737


"bw" wrote:

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)?






All times are GMT +1. The time now is 10:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com