ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change text in rectangle shape (https://www.excelbanter.com/excel-programming/381700-re-change-text-rectangle-shape.html)

Tom Ogilvy

Change text in rectangle shape
 
If they are textboxes from the Drawing toolbar

Sub AABBCCDD()
Dim tbox As TextBox
For Each tbox In ActiveSheet.TextBoxes
If InStr(1, tbox.Text, "2006", vbTextCompare) Then
tbox.Text = Application.Substitute( _
tbox.Text, "2006", "2007")
End If
Next
End Sub

if they are textboxes from the control toolbox toolbar

Sub AACCDD()
Dim ol As OLEObject
Dim tbox As MSForms.TextBox
For Each ol In ActiveSheet.OLEObjects
If TypeOf ol.Object Is MSForms.TextBox Then
Set tbox = ol.Object
tbox.Text = Replace(tbox, "2006", "2007")
End If
Next
End Sub

--
Regards,
Tom Ogilvy
"Finance guy" wrote in message
...

How can I enumerate through all worksheets and rectangles and add a text
string to all textboxes all of them currently say ©2006 I need to
change
it to 2007.





All times are GMT +1. The time now is 01:41 AM.

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