Last active
August 29, 2015 14:21
-
-
Save rs77/5231aafd7584240d401c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function AlphaNumericOnly(strSource As String) As String | |
Dim i As Integer | |
Dim strResult As String | |
For i = 1 To Len(strSource) | |
Select Case Asc(Mid(strSource, i, 1)) | |
Case 32, 48 To 57: 'include 32 if you want to include space | |
strResult = strResult & Mid(strSource, i, 1) | |
End Select | |
Next | |
AlphaNumericOnly = Strings.Trim(strResult) | |
End Function | |
Sub CleanAll() | |
Dim rng As Range | |
For Each rng In Sheets("CustomersWithNoPhoneinAddressRe").Range("C2:E5000").Cells 'adjust sheetname and range accordingly | |
rng.Value = AlphaNumericOnly(rng.Value) | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment