ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Format Question (https://www.excelbanter.com/excel-discussion-misc-queries/237116-format-question.html)

Dabeaks

Format Question
 
Hello,

I have a whole bunch of phone numbers listed in the following format:

###.###.####

Is there a way to change all of them to this format:

(###) ###-###

Please help

Daniel.C[_3_]

Format Question
 
Hello.
Try the following macro :

Sub test()
Dim c As Range
For Each c In Selection
If c.NumberFormat = "###"".""###"".""####" Or _
c.NumberFormat = "###\.###\.####" Then
c.NumberFormat = "(###) ###-###"
End If
Next c
End Sub

HTH
Daniel

Hello,

I have a whole bunch of phone numbers listed in the following format:

###.###.####

Is there a way to change all of them to this format:

(###) ###-###

Please help




Dabeaks

Format Question
 
Daniel,

Maybe I'm doing it wrong. but I copied and pasted that into the "record
Macro" description. I also enabled the Macros. Nothing changed at all after
this. Am I missing a step? This is the first time I'm using Macros in excel.

Adam

"Daniel.C" wrote:

Hello.
Try the following macro :

Sub test()
Dim c As Range
For Each c In Selection
If c.NumberFormat = "###"".""###"".""####" Or _
c.NumberFormat = "###\.###\.####" Then
c.NumberFormat = "(###) ###-###"
End If
Next c
End Sub

HTH
Daniel

Hello,

I have a whole bunch of phone numbers listed in the following format:

###.###.####

Is there a way to change all of them to this format:

(###) ###-###

Please help





Pimamedic

Format Question
 
Format Cells Special Telephone Number

"Dabeaks" wrote:

Hello,

I have a whole bunch of phone numbers listed in the following format:

###.###.####

Is there a way to change all of them to this format:

(###) ###-###

Please help


Dave Peterson

Format Question
 
If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Dabeaks wrote:

Daniel,

Maybe I'm doing it wrong. but I copied and pasted that into the "record
Macro" description. I also enabled the Macros. Nothing changed at all after
this. Am I missing a step? This is the first time I'm using Macros in excel.

Adam

"Daniel.C" wrote:

Hello.
Try the following macro :

Sub test()
Dim c As Range
For Each c In Selection
If c.NumberFormat = "###"".""###"".""####" Or _
c.NumberFormat = "###\.###\.####" Then
c.NumberFormat = "(###) ###-###"
End If
Next c
End Sub

HTH
Daniel

Hello,

I have a whole bunch of phone numbers listed in the following format:

###.###.####

Is there a way to change all of them to this format:

(###) ###-###

Please help





--

Dave Peterson


All times are GMT +1. The time now is 09:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com