add a space between phone number fields

bobpic

New Member
Joined
Jan 14, 2005
Messages
24
I have a column of phone numbers, xxxxxxxxxx, I would like to put a space to separate for easy viewing xxx xxx xxxx. ( some of the numbers have a 1 in front, so I would like it to display x xxx xxx xxxx.
Thanks
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try a custom number format of
# 000 000 000
 
Upvote 0
Alternatively try:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG03Aug57
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] Dn [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    [COLOR="Navy"]If[/COLOR] Len(Dn) = 10 [COLOR="Navy"]Then[/COLOR]
        Dn = Left(Dn, 3) & " " & Mid(Dn, 3, 3) & " " & Right(Dn, 4)
    [COLOR="Navy"]ElseIf[/COLOR] Left(Dn, 1) = 1 [COLOR="Navy"]Then[/COLOR]
        Dn = Left(Dn, 1) & " " & Mid(Dn, 2, 3) & " " & Mid(Dn, 4, 3) & " " & Right(Dn, 4)
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,819
Members
449,469
Latest member
Kingwi11y

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top