DragonTamer
New Member
- Joined
- Jun 13, 2018
- Messages
- 3
Hello!
I know I am probably making a very basic mistake that my brain just isn't picking up on.
I am writing a simple macro to replace special characters in a column (,.?#, etc.). This has to be used in several different sheets and the columns will vary. So I have the following code started:
Sub SpecCharRepl()
'
' Special Character Replacement Macro
Dim rng As Range
Dim cell As Range
Set rng = Selection
For Each cell In rng
Do Until cell.Value = Empty
Cells.Replace What:="$", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:=",", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:=".", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Loop
Next cell
End Sub
I keep getting stuck in the loop. Please give me a good Gib smack and point out what rule I am breaking! Thanks!
I know I am probably making a very basic mistake that my brain just isn't picking up on.
I am writing a simple macro to replace special characters in a column (,.?#, etc.). This has to be used in several different sheets and the columns will vary. So I have the following code started:
Sub SpecCharRepl()
'
' Special Character Replacement Macro
Dim rng As Range
Dim cell As Range
Set rng = Selection
For Each cell In rng
Do Until cell.Value = Empty
Cells.Replace What:="$", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:=",", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:=".", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Loop
Next cell
End Sub
I keep getting stuck in the loop. Please give me a good Gib smack and point out what rule I am breaking! Thanks!