View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default 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.