Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do you Find and Replace the word "and" but not the and in "han
I thought there was a - match whole word - option with the Find and Replace
tool but I don't see it now. I'm trying to replace every "and" with "&" but not affect any words that contain "and" such as "hand" or "bandit". |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do you Find and Replace the word "and" but not the and in "han
Be sure to type a single space before and after the and
-- Gary''s Student - gsnu200764 "Lyn" wrote: I thought there was a - match whole word - option with the Find and Replace tool but I don't see it now. I'm trying to replace every "and" with "&" but not affect any words that contain "and" such as "hand" or "bandit". |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do you Find and Replace the word "and" but not the and in
Thanks so much! That did it!
"Gary''s Student" wrote: Be sure to type a single space before and after the and -- Gary''s Student - gsnu200764 "Lyn" wrote: I thought there was a - match whole word - option with the Find and Replace tool but I don't see it now. I'm trying to replace every "and" with "&" but not affect any words that contain "and" such as "hand" or "bandit". |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do you Find and Replace the word "and" but not the and in "han
I'm not aware of a way to do that, someone here might enlighten us. What i do
know is that you have an and as a word it will have spaces on both sides so you can use " and " to get all those. Be warned that anything that starts with and or has punctuation after it will not get changed. -- -John Please rate when your question is answered to help us and others know what is helpful. "Lyn" wrote: I thought there was a - match whole word - option with the Find and Replace tool but I don't see it now. I'm trying to replace every "and" with "&" but not affect any words that contain "and" such as "hand" or "bandit". |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do you Find and Replace the word "and" but not the and in "han
On Thu, 10 Jan 2008 06:36:01 -0800, Lyn wrote:
I thought there was a - match whole word - option with the Find and Replace tool but I don't see it now. I'm trying to replace every "and" with "&" but not affect any words that contain "and" such as "hand" or "bandit". If you do not want to change "and" when it is at the beginning or end of the string, then Find what: <spaceand<space Replace with: <space&<space If you also want to replace "and" when it occurs at the beginning and end of the line, then you can use this macro on a cell selection: ============================== Option Explicit Sub reReplace() Dim c As Range Dim re As Object 'This pattern will replace all "and" including ' those at beginning and end of string 'To omit those at the beginning and end 'Const sPat As String = "\sand\s" 'Const sRepl As String = " & " Const sPat As String = "\band\b" Const sRepl As String = "&" Set re = CreateObject("vbscript.regexp") re.Pattern = sPat re.Global = True re.ignorecase = True For Each c In Selection c.Value = re.Replace(c.Value, sRepl) Next c End Sub =================================== --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Check if cells contain the word "Thailand", return "TRUE" | Excel Worksheet Functions | |||
How to replace "#N/A" w "0"when vlookup couldn't find the match? | Excel Discussion (Misc queries) | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Replace dialog should put focus on "Find What" not "Replace With" | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel |