I'm trying to use some code to format a phone number column and fax number column that contain both US numbers and international numbers.
Here is what I'm trying:
Function cleanPhoneNumber(thisNumber As String) As String
' this function aspires to clean any phone number format
' to standard format (+9999) 999-999-9999 or 999-999-9999
' works with almost all phone number formats stored in text
Dim retNumber As String
For i = 1 To Len(thisNumber)
If Asc(Mid(thisNumber, i, 1)) >= Asc("0") And Asc(Mid(thisNumber, i, 1)) <= Asc("9") Then
retNumber = retNumber + Mid(thisNumber, i, 1)
If Len(retNumber) > 10 Then
' format for country code as well
cleanPhoneNumber = Format(retNumber, "(+#) (000) 000-0000")
cleanPhoneNumber = Format(retNumber, "(+1) (000) 000-0000")
The function doesn't even show up when I click on macro to run it?
Any help is appreciated.