Two questions.
1. When using the replace method, what does LookAt do/mean? The only documentation I can find tells me to use either xlPart or xlWhole but doesn't say what these things mean.
2. I'm trying to search for "(" and replace it with "B" for all the cells in my active worksheet. Here's my code:
Sub cleanuptext()
ActiveSheet.Cells.Replace What:="(", Replacement:="B", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
End Sub
I get this error:
"The formula you typed contains an error..."
I finally figured out that the problem is the paren because if I search for A and replace it with B, it works fine. I tried to escape the paren by:
ActiveSheet.Cells.Replace What:="\(", Replacement:="B" etc.
No errors, but it does not do the replacement.
Any ideas?
TIA, Susie
1. When using the replace method, what does LookAt do/mean? The only documentation I can find tells me to use either xlPart or xlWhole but doesn't say what these things mean.
2. I'm trying to search for "(" and replace it with "B" for all the cells in my active worksheet. Here's my code:
Sub cleanuptext()
ActiveSheet.Cells.Replace What:="(", Replacement:="B", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
End Sub
I get this error:
"The formula you typed contains an error..."
I finally figured out that the problem is the paren because if I search for A and replace it with B, it works fine. I tried to escape the paren by:
ActiveSheet.Cells.Replace What:="\(", Replacement:="B" etc.
No errors, but it does not do the replacement.
Any ideas?
TIA, Susie