Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Change input in batch

I have a long list of phone numbers that were input as text in the following
format: xxx-xxx-xxxx. If I change the cell format to "cutom" and "phone",
under edit cells, then remove the hyphens, I end up with (xxx) xxx-xxxx. This
is what I want; however cannot figure out hot to write a macro or otherwise
to do it automatically.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default Change input in batch

Highlight the column, EditReplace

find: -
Replace with: (leave this blank)

Replace All

Format column as phone #

"WarrenL" wrote:

I have a long list of phone numbers that were input as text in the following
format: xxx-xxx-xxxx. If I change the cell format to "cutom" and "phone",
under edit cells, then remove the hyphens, I end up with (xxx) xxx-xxxx. This
is what I want; however cannot figure out hot to write a macro or otherwise
to do it automatically.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,071
Default Change input in batch

Warren
This little macro should do what you want. I assumed that your phone
numbers are in Column A starting in A2. Change this as needed. This macro
will change both 123-456-7891 and 1234567891 to (123) 456-7891. HTH Otto
Sub PhoneNum()
Dim rColA As Range, i As Range
Set rColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
For Each i In rColA
i = Replace(i, "-", "")
i.NumberFormat = "[<=9999999]###-####;(###) ###-####"
Next i
End Sub
"WarrenL" wrote in message
...
I have a long list of phone numbers that were input as text in the
following
format: xxx-xxx-xxxx. If I change the cell format to "cutom" and "phone",
under edit cells, then remove the hyphens, I end up with (xxx) xxx-xxxx.
This
is what I want; however cannot figure out hot to write a macro or
otherwise
to do it automatically.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
run batch job from each row - how to insert run batch function per row? Mitchell_Collen via OfficeKB.com Excel Discussion (Misc queries) 5 February 26th 09 07:16 AM
how to change input general question Excel Discussion (Misc queries) 1 February 5th 09 04:05 AM
cell input change dciufo Excel Discussion (Misc queries) 2 March 22nd 07 09:18 AM
Batch change Tester Excel Discussion (Misc queries) 0 November 9th 05 02:32 PM
Change the input in a sheet by OptBox Michael Excel Discussion (Misc queries) 0 June 28th 05 12:25 PM


All times are GMT +1. The time now is 12:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"