Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How do I find and replace text in a Text Box?
-- Ed |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find and replace part of a text string | Excel Discussion (Misc queries) | |||
Find & Replace text format | Excel Discussion (Misc queries) | |||
How do you find and replace text in autoshapes or comments | Excel Discussion (Misc queries) | |||
Find/Replace Text In Cells | Excel Discussion (Misc queries) | |||
Find&Replace * - Is it possible to treat * as text and not wildcar | Excel Discussion (Misc queries) |