Forum Discussion
chipwdomi
Sep 20, 2021Copper Contributor
excel formatting of telephone numbers
this is in the excel cell how it looks (954) 731-5100 see how the number here is actually all the way to the right in the cell (no cell alignment was used) see there is no ( ) in the f...
HansVogelaar
Sep 20, 2021MVP
In your examples in red, the cell value is a number. That is why you see it as a plain mumber in the formula bar. A special number format has been applied to it to make it appear as a phone number in the cell, but the value stored in the workbook is the plain number.
If you want a value such as (954) 731-5100 to be the stored value, it must be a text value, not a number.
I don't know why some values come over from the database as a number and others as a text value.
To convert all phone numbers to text values, you could run the following macro. Select the range with phone numbers first.
Sub ConvertPhoneNumbers()
Dim rng As Range
Application.ScreenUpdating = False
For Each rng In Selection
If IsNumeric(rng.Value) Then
rng.Value = rng.Text
End If
Next rng
Application.ScreenUpdating = True
End Sub