Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ed Ed is offline
external usenet poster
 
Posts: 279
Default Find & Replace in Text Box

How do I find and replace text in a Text Box?
--
Ed
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,173
Default Find & Replace in Text Box

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


  #3   Report Post  
Posted to microsoft.public.excel.misc
Ed Ed is offline
external usenet poster
 
Posts: 279
Default Find & Replace in Text Box

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



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Find & Replace in Text Box

This will work for a "controls" type textbox:

Sub dural()
Dim s As String
s = ActiveSheet.TextBox1.Object.Value
s = Replace(s, "all", "a few")
ActiveSheet.TextBox1.Object.Value = s
End Sub
--
Gary's Student
gsnu200711

  #5   Report Post  
Posted to microsoft.public.excel.misc
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


  #6   Report Post  
Posted to microsoft.public.excel.misc
Ed Ed is offline
external usenet poster
 
Posts: 279
Default Find & Replace in Text Box

Hi Dave and Gary"s Student,

Thanks for responding to my question. I am studying to become a Microsoft
Office Specialist. You two opened up a whole new area of Excel that I am not
yet familiar with. The more I learn about Excel, the more it amazes me. Can
one of you walk me through an example. For example, I have this text in
several texboxes: "30005SFN_I, 1-200". I would like to change it
to:"2611BFN_I, 1-200". How would I do that? The text box is from the Drawing
tool bar.

Thanks
--
Ed


"Gary''s Student" wrote:

This will work for a "controls" type textbox:

Sub dural()
Dim s As String
s = ActiveSheet.TextBox1.Object.Value
s = Replace(s, "all", "a few")
ActiveSheet.TextBox1.Object.Value = s
End Sub
--
Gary's Student
gsnu200711

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Find & Replace in Text Box

If you're using xl2k or above and the code I suggested, then you'd change these
lines:

FromStr = "test"
ToStr = "real"

To what you want.

FromStr is short for "From String"
toStr is short for "To String"

Ed wrote:

Hi Dave and Gary"s Student,

Thanks for responding to my question. I am studying to become a Microsoft
Office Specialist. You two opened up a whole new area of Excel that I am not
yet familiar with. The more I learn about Excel, the more it amazes me. Can
one of you walk me through an example. For example, I have this text in
several texboxes: "30005SFN_I, 1-200". I would like to change it
to:"2611BFN_I, 1-200". How would I do that? The text box is from the Drawing
tool bar.

Thanks
--
Ed

"Gary''s Student" wrote:

This will work for a "controls" type textbox:

Sub dural()
Dim s As String
s = ActiveSheet.TextBox1.Object.Value
s = Replace(s, "all", "a few")
ActiveSheet.TextBox1.Object.Value = s
End Sub
--
Gary's Student
gsnu200711


--

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

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ed wrote:

Hi Dave and Gary"s Student,

Thanks for responding to my question. I am studying to become a Microsoft
Office Specialist. You two opened up a whole new area of Excel that I am not
yet familiar with. The more I learn about Excel, the more it amazes me. Can
one of you walk me through an example. For example, I have this text in
several texboxes: "30005SFN_I, 1-200". I would like to change it
to:"2611BFN_I, 1-200". How would I do that? The text box is from the Drawing
tool bar.

Thanks
--
Ed

"Gary''s Student" wrote:

This will work for a "controls" type textbox:

Sub dural()
Dim s As String
s = ActiveSheet.TextBox1.Object.Value
s = Replace(s, "all", "a few")
ActiveSheet.TextBox1.Object.Value = s
End Sub
--
Gary's Student
gsnu200711


--

Dave Peterson
  #9   Report Post  
Posted to microsoft.public.excel.misc
Ed Ed is offline
external usenet poster
 
Posts: 279
Default Find & Replace in Text Box

Dave,

I just used the macro and it works great. Thanks for answering my question
and for opening up a whole new area of Excel to me.

Ed
--
Ed


"Dave Peterson" wrote:

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ed wrote:

Hi Dave and Gary"s Student,

Thanks for responding to my question. I am studying to become a Microsoft
Office Specialist. You two opened up a whole new area of Excel that I am not
yet familiar with. The more I learn about Excel, the more it amazes me. Can
one of you walk me through an example. For example, I have this text in
several texboxes: "30005SFN_I, 1-200". I would like to change it
to:"2611BFN_I, 1-200". How would I do that? The text box is from the Drawing
tool bar.

Thanks
--
Ed

"Gary''s Student" wrote:

This will work for a "controls" type textbox:

Sub dural()
Dim s As String
s = ActiveSheet.TextBox1.Object.Value
s = Replace(s, "all", "a few")
ActiveSheet.TextBox1.Object.Value = s
End Sub
--
Gary's Student
gsnu200711


--

Dave Peterson

  #10   Report Post  
Posted to microsoft.public.excel.misc
JB JB is offline
external usenet poster
 
Posts: 115
Default Find & Replace in Text Box

Hello,

Replace SubString with another string in TextBox.

Sub ReplaceTextBox(NameTextBox, SearchString, StringReplace)
ActiveSheet.Shapes(NameTextBox).TextFrame.Characte rs.Text = _
Replace(ActiveSheet.Shapes(NameTextBox).TextFrame. Characters.Text,
SearchString, StringReplace)
End Sub

Sub essai()
ReplaceTextBox "xxx", "sample", "zzz"
End Sub

http://cjoint.com/?dzr3sAgRjI

JB http://boisgontierj.free.fr

On 24 mar, 16:00, Ed wrote:
How do I find and replace text in a Text Box?
--
Ed





  #11   Report Post  
Posted to microsoft.public.excel.misc
Ed Ed is offline
external usenet poster
 
Posts: 279
Default Find & Replace in Text Box

Hi JB,

Thanks for answering my question.
--
Ed


"JB" wrote:

Hello,

Replace SubString with another string in TextBox.

Sub ReplaceTextBox(NameTextBox, SearchString, StringReplace)
ActiveSheet.Shapes(NameTextBox).TextFrame.Characte rs.Text = _
Replace(ActiveSheet.Shapes(NameTextBox).TextFrame. Characters.Text,
SearchString, StringReplace)
End Sub

Sub essai()
ReplaceTextBox "xxx", "sample", "zzz"
End Sub

http://cjoint.com/?dzr3sAgRjI

JB http://boisgontierj.free.fr

On 24 mar, 16:00, Ed wrote:
How do I find and replace text in a Text Box?
--
Ed




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and replace part of a text string [email protected] Excel Discussion (Misc queries) 2 July 10th 06 10:34 PM
Find & Replace text format jmn13 Excel Discussion (Misc queries) 2 May 25th 06 06:18 PM
How do you find and replace text in autoshapes or comments the_lipster Excel Discussion (Misc queries) 0 June 17th 05 12:35 AM
Find/Replace Text In Cells Rob Excel Discussion (Misc queries) 1 April 11th 05 04:01 AM
Find&Replace * - Is it possible to treat * as text and not wildcar Stringy Excel Discussion (Misc queries) 2 April 6th 05 10:23 PM


All times are GMT +1. The time now is 12:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"