Rename all shapes in active sheet

haseft

Active Member
Joined
Jun 10, 2014
Messages
321
Hi!

In Worksheet1 I have a lot of shapes, some has same name.
I want to rename all shapes in Worksheet1 to: Picture1, Picture2, Picture3, Picture4, ..... and so on.
Please help.

HTML:
Function ShapeAtActiveCell() As String
Dim Sh As Shape

For Each Sh In ActiveSheet.Shapes
    If Sh.TopLeftCell.Address = ActiveCell.Address Then
       ShapeAtActiveCell = Sh.Name
       ActiveSheet.Shapes(ShapeAtActiveCell).Select
       Exit Function
    End If
Next
End Function

'--------------

Sub RenameShapes()
Dim p As String, n As Long
p = "Picture"
n = 1000

For i = 1 To n
   With Worksheets("Sheet1")
     .Shapes(ShapeAtActiveCell).Name = p + i
   End With
Next
End Sub
 
Last edited:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
How about
Code:
Sub RenameShapes()
Dim sh As Shape, i As Long
For Each sh In ActiveSheet.Shapes
   i = i + 1
   sh.Name = "Picture" & i
Next sh
End Sub
 
Upvote 0
Solution
Thanks Fluff!
If I undrstand, in this case there is no need use Function ShapeAtActiveCell.
Or?
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,216,103
Messages
6,128,854
Members
449,472
Latest member
ebc9

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top