ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Search And Replace Whole Words (https://www.excelbanter.com/excel-programming/348679-search-replace-whole-words.html)

Mary H

Search And Replace Whole Words
 
I am writing a program that searchs a column for code numbers and replaces it
with a descritpion of that corresponding code number. Here is an exerpt of
the code

Columns("I:I").Select
Selection.Replace What:="20", Replacement:="general damage"

The problem I am having is if there is a code 5420 or anything else that has
that number in it, it replaces the 20 part with the text specified. I would
like to know how to do a search and replace of a whole value.

Thanks in advance

Toppers

Search And Replace Whole Words
 
Hi,

Columns("I:I").Select
Selection.Replace What:="20", Replacement:="general damage", lookat:=xlWhole

HTH

"Mary H" wrote:

I am writing a program that searchs a column for code numbers and replaces it
with a descritpion of that corresponding code number. Here is an exerpt of
the code

Columns("I:I").Select
Selection.Replace What:="20", Replacement:="general damage"

The problem I am having is if there is a code 5420 or anything else that has
that number in it, it replaces the 20 part with the text specified. I would
like to know how to do a search and replace of a whole value.

Thanks in advance


Mary H[_2_]

Search And Replace Whole Words
 
thank you

"Toppers" wrote:

Hi,

Columns("I:I").Select
Selection.Replace What:="20", Replacement:="general damage", lookat:=xlWhole

HTH

"Mary H" wrote:

I am writing a program that searchs a column for code numbers and replaces it
with a descritpion of that corresponding code number. Here is an exerpt of
the code

Columns("I:I").Select
Selection.Replace What:="20", Replacement:="general damage"

The problem I am having is if there is a code 5420 or anything else that has
that number in it, it replaces the 20 part with the text specified. I would
like to know how to do a search and replace of a whole value.

Thanks in advance



All times are GMT +1. The time now is 05:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com