dj44
11-27-2017, 03:08 AM
Good Morning folks,
any one know how i can search and replace for exact only,
my array has
FCPH and CPH so i get that replaced twice
as FCPH contains CPH
Sub Replace_Exact()
oSearch = Array("Apple", "Pear", "FCPH", "CPH")
For i = LBound(oSearch) To UBound(oSearch)
For Each ocell In ThisWorkbook.Worksheets("AA").Range("A1:A100").Cells
ocell.Replace What:=oSearch(i), Replacement:="test"
Next ocell
Next i
End Sub
how can i limit the search to exact only ?
any one know how i can search and replace for exact only,
my array has
FCPH and CPH so i get that replaced twice
as FCPH contains CPH
Sub Replace_Exact()
oSearch = Array("Apple", "Pear", "FCPH", "CPH")
For i = LBound(oSearch) To UBound(oSearch)
For Each ocell In ThisWorkbook.Worksheets("AA").Range("A1:A100").Cells
ocell.Replace What:=oSearch(i), Replacement:="test"
Next ocell
Next i
End Sub
how can i limit the search to exact only ?