This is Code Copy it and paste in Excel.
Sub Remove91()
Dim cell As Range
For Each cell In Selection
Dim cleanNum As String
cleanNum = Replace(cell.Value, "+91", "") 'Removes +91
'If it starts with 91 and is longer than 10 digits
If Left(cleanNum, 2) = "91" And Len(cleanNum) > 10 Then
cleanNum = Right(cleanNum, 10)
End If
cell.Value = cleanNum
Next cell
MsgBox "All numbers cleaned!", vbInformation
End Sub
See the video.
No comments:
Post a Comment