In case this question sounds too basic, I'm telling that I have zero experience on Excel VBA. I've already tried using Dim and arrays but I'm not achieving my goal. I either get errors or an infinite loop.
Basically I have 5 different old text to replace and I want to create an array, loop around it so that they are all removed.
Sub AutoReplace()
Dim myArray(1 To 5) As String
myArray(1) = "Text1"
myArray(2) = "Text2"
myArray(3) = "Text3"
myArray(4) = "Text4"
myArray(5) = "Text5"
For Each item In myArray
ActiveCell.Select
ActiveCell.Columns("A:A").EntireColumn.Select
Selection.Replace What:=item, Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Next item
End Sub
I'm looking for either a suggestion on what's wrong with my code, or a totally different approach. The end goal I have mentioned above only.