Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formula to Macro help PLEASE


I have a column of telephone numbers. I need to change the area code and
first three digits of each of these numbers to a new area code and new
first thee digits. Example: 5555555555 change to (444)444-5555. notice
the last four digits need to stay the same.
If I have 100 numbers to change, the last 4 digits will be 100 unique
numbers. The formula =value(444444&right(a1:a100,4)) works however I
need to do this as part of a Macro ( for ease to the person using the
spreadsheet ) need some help PLEASE !!! thanks


--
Hemming
------------------------------------------------------------------------
Hemming's Profile: http://www.excelforum.com/member.php...o&userid=32185
View this thread: http://www.excelforum.com/showthread...hreadid=520559

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Formula to Macro help PLEASE

Enter this macro:

Sub Macro1()
Dim r As Range
Dim s1 As String
Dim s3 As String
s3 = "(444)444-"
For Each r In Selection
s1 = r.Value
r.Value = s3 & Right(s1, 4)
Next
End Sub

Then on the worksheet, select the cells you want to convert and run the macro
--
Gary's Student


"Hemming" wrote:


I have a column of telephone numbers. I need to change the area code and
first three digits of each of these numbers to a new area code and new
first thee digits. Example: 5555555555 change to (444)444-5555. notice
the last four digits need to stay the same.
If I have 100 numbers to change, the last 4 digits will be 100 unique
numbers. The formula =value(444444&right(a1:a100,4)) works however I
need to do this as part of a Macro ( for ease to the person using the
spreadsheet ) need some help PLEASE !!! thanks


--
Hemming
------------------------------------------------------------------------
Hemming's Profile: http://www.excelforum.com/member.php...o&userid=32185
View this thread: http://www.excelforum.com/showthread...hreadid=520559


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Formula to Macro help PLEASE

You have other suggestions at your other posts.

Hemming wrote:

I have a column of telephone numbers. I need to change the area code and
first three digits of each of these numbers to a new area code and new
first thee digits. Example: 5555555555 change to (444)444-5555. notice
the last four digits need to stay the same.
If I have 100 numbers to change, the last 4 digits will be 100 unique
numbers. The formula =value(444444&right(a1:a100,4)) works however I
need to do this as part of a Macro ( for ease to the person using the
spreadsheet ) need some help PLEASE !!! thanks

--
Hemming
------------------------------------------------------------------------
Hemming's Profile: http://www.excelforum.com/member.php...o&userid=32185
View this thread: http://www.excelforum.com/showthread...hreadid=520559


--

Dave Peterson
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
How to add a formula using a macro Lawribird Excel Worksheet Functions 1 July 31st 09 04:34 PM
Need a formula/Macro Srikanth Excel Discussion (Misc queries) 3 March 27th 08 10:58 AM
Formula or Macro help?... Klee Excel Discussion (Misc queries) 0 July 28th 07 06:52 PM
Sum Formula in Macro Tim U[_2_] Excel Programming 3 June 9th 05 02:18 PM
Using the And formula in a VBA macro Corinne R Excel Programming 5 April 30th 04 11:40 PM


All times are GMT +1. The time now is 11:51 PM.

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"