+ Reply to Thread
Results 1 to 6 of 6

HELP, changing phone number periods to hypens vba code

Hybrid View

  1. #1
    Registered User
    Join Date
    05-31-2013
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2010
    Posts
    17

    Question HELP, changing phone number periods to hypens vba code

    Hello everyone - back again for more torture. I am trying to conduct a find and replace in excel via vba that will find phone numbers in the format of 000.000.000 and change them to 000-000-000. Any suggestions!

  2. #2
    Forum Contributor
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    167

    Re: HELP, changing phone number periods to hypens vba code

    hi, here is the code...dont forget to solved the post and to give me a star :D

    Sub ReplacePhone()
    '
    ' ReplacePhone Macro
    '
    
    '
        Cells.Select
        Selection.Replace What:="000.000.000", Replacement:="000-000-000", LookAt _
            :=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
            ReplaceFormat:=False
    End Sub

  3. #3
    Registered User
    Join Date
    05-31-2013
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: HELP, changing phone number periods to hypens vba code

    I need for the 0's to be any number from 0-9.

  4. #4
    Forum Contributor
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    167

    Re: HELP, changing phone number periods to hypens vba code

    well..that would be another post...this one is over ....

    solved this post then start another one

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: HELP, changing phone number periods to hypens vba code

    Why not just use regular Find/Replace?

    highlight the data, press ctrl H....find . replace -

    @ extremis the OP's querstion is not solved, and they do not need to start a new 1, seems to me you mis-understood the requirement
    Last edited by FDibbins; 06-28-2013 at 04:23 PM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    05-31-2013
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: HELP, changing phone number periods to hypens vba code

    Regular find and replace is not what I am looking for in this solution. If I conduct a regular find/replace it will replace all periods within my data and not just the phone number periods. The phone number in the cells is surrounded by other text as it's a description column for vendors. I am creating a scrub data macro to eliminate repetitive data entry tasks within proofing files.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1