I was trying to create a script in vba which check the cell "A1" and replaces the first 2 charecters of the string to a integer if the first 2 characters are Ni lets say then change them to 801 . should look something like that:
originaltext = Range("a1").Value
If (Left(A1, 2) = "NI") Then newtext = Replace("originaltext", "NI", "801")
ElseIf (Left(A1, 2) = "RE") Then newtext = Replace("originaltext", "RE", "821")
ElseIf (Left(A1, 2) = "NV") Then newtext = Replace("originaltext", "NV", "571")
ElseIf (Left(A1, 2) = "NF") Then newtext = Replace("originaltext", "NF", "831")
end if n=n+1 Loop
i want it to go trough every cell and do that action starting from a1 lets say all the way down to a2 and a3 and so on.
how do i create a right loop for that?
originaltext = Range("a1").Value
If (Left(A1, 2) = "NI") Then newtext = Replace("originaltext", "NI", "801")
ElseIf (Left(A1, 2) = "RE") Then newtext = Replace("originaltext", "RE", "821")
ElseIf (Left(A1, 2) = "NV") Then newtext = Replace("originaltext", "NV", "571")
ElseIf (Left(A1, 2) = "NF") Then newtext = Replace("originaltext", "NF", "831")
end if n=n+1 Loop
i want it to go trough every cell and do that action starting from a1 lets say all the way down to a2 and a3 and so on.
how do i create a right loop for that?