ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help needed trying to find autoshape/shape name (https://www.excelbanter.com/excel-programming/362176-help-needed-trying-find-autoshape-shape-name.html)

funkymonkUK[_174_]

help needed trying to find autoshape/shape name
 

hi i got a sheet which I copy and insert it at the end of the workboo
problem is that I have a rectangle which I would like text to be insid
however it changes names as soon as I copy it is there a way I could us
like a variable to do what I want with the only shape on my sheet.


Code
-------------------
Sub Macro6()

ActiveSheet.Shapes("Rectangle 1627").Select
Selection.Characters.Text = "hello world. Its" & Now()
End Sub

-------------------

--
funkymonkU
-----------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...fo&userid=1813
View this thread: http://www.excelforum.com/showthread.php?threadid=54469


Tom Ogilvy

help needed trying to find autoshape/shape name
 
You say you only have one shape, but you have already described having a
command button on the sheet, which is a shape as well. So I assume you know
where the shape is located:

for each shp in ActiveWorksheet.Shapes
if shp.TopLeftCell.Address = "$B$9" then
shp.TextFrame.Characters.Text = "hello world. Its" & Now()
end if
Next

--
Regards,
Tom Ogilvy


"funkymonkUK" wrote:


hi i got a sheet which I copy and insert it at the end of the workbook
problem is that I have a rectangle which I would like text to be inside
however it changes names as soon as I copy it is there a way I could use
like a variable to do what I want with the only shape on my sheet.


Code:
--------------------
Sub Macro6()

ActiveSheet.Shapes("Rectangle 1627").Select
Selection.Characters.Text = "hello world. Its" & Now()
End Sub

--------------------


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=544699




All times are GMT +1. The time now is 05:25 PM.

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