Hi,
I’m trying to write a piece of code to find all full stops with a space or spaces in front of it. To be replaced with a full stop with no spaces. It works if I state
what = “ .”
But as there can be more than one space before the full stop. It ignores anything with more than one space. I want to include something that can be any amount of spaces i.e. a wildcard.
Am I on the right track?
Sub replace()
Dim findit As String
Dim repl As String
Dim what As String
what = "."
repl = "."
Cells.replace what:=what, Replacement:=repl, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
I’m trying to write a piece of code to find all full stops with a space or spaces in front of it. To be replaced with a full stop with no spaces. It works if I state
what = “ .”
But as there can be more than one space before the full stop. It ignores anything with more than one space. I want to include something that can be any amount of spaces i.e. a wildcard.
Am I on the right track?
Sub replace()
Dim findit As String
Dim repl As String
Dim what As String
what = "."
repl = "."
Cells.replace what:=what, Replacement:=repl, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub