View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Find & Replace in Text Box

This will work in xl2k and above (replace was added in xl2k):

Option Explicit
Sub testme()
Dim FromStr As String
Dim ToStr As String
Dim TB As TextBox
Dim wks As Worksheet

FromStr = "test"
ToStr = "real"

Set wks = ActiveSheet

With wks
For Each TB In .TextBoxes
With TB
.Text = Replace(expression:=.Text, _
Find:=FromStr, _
Replace:=ToStr, _
Start:=1, _
Count:=-1, _
compa=vbTextCompare)
End With
Next TB
End With

End Sub



Ed wrote:

Nick,

Thanks for responding. I want to use the find and replace in the Text Box on
the drawing tool bar.
Ed
--
Ed

"Nick Hodge" wrote:

Ed

We will need a little more detail than that

Data Validation textbox, activeX textbox, forms textbox, on a worksheet, on
a form,etc, etc.

In theory there is no search and replace for controls, you will need to
iterate the controls and test for their contents

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Ed" wrote in message
...
How do I find and replace text in a Text Box?
--
Ed




--

Dave Peterson