I am formatting some data I received. I have several hundred names of students in Column A, and for some strange reason there is a random *
placed randomly through
You don't need to loop through the cell. You can use Excel's inbuilt .Replace
function to replace all *
by using "~*"
Here is an example
Option Explicit
Sub Sample()
Dim ws As Worksheet
Dim Rng As Range
'~~> Change this to the relevant worksheet
Set ws = ThisWorkbook.Sheets("Sheet1")
'~~> Change this to the relevant range
Set Rng = ws.Range("A2:A300")
Rng.Replace What:="~*", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
End Sub