Hey.
I have this script which checks and replaces first 2 characters in a cell(total 4 strings for it check for).
I want to add that IF the cell does not start with one of these strings then it should delete the row completely.
Here is the codeThe strings im checking for are marked)
Sub Change_Replace()
Dim Ary As Variant
Dim i As Long
Ary = Array("NI", "801", "RE", "821", "NV", "571", "NF", "831")
For i = 0 To UBound(Ary) Step 2
With Range("A2", Range("A" & Rows.Count).End(xlUp))
.Value = Evaluate(Replace("if(left(@,2)=""" & Ary(i) & """," & Ary(i + 1) & "&mid(@,3,100),@)", "@", .Address))
End With
Next i
End Sub
I have this script which checks and replaces first 2 characters in a cell(total 4 strings for it check for).
I want to add that IF the cell does not start with one of these strings then it should delete the row completely.
Here is the codeThe strings im checking for are marked)
Sub Change_Replace()
Dim Ary As Variant
Dim i As Long
Ary = Array("NI", "801", "RE", "821", "NV", "571", "NF", "831")
For i = 0 To UBound(Ary) Step 2
With Range("A2", Range("A" & Rows.Count).End(xlUp))
.Value = Evaluate(Replace("if(left(@,2)=""" & Ary(i) & """," & Ary(i + 1) & "&mid(@,3,100),@)", "@", .Address))
End With
Next i
End Sub