Consulting

Results 1 to 5 of 5

Thread: Solved: Solved-Format Phone Number

  1. #1
    VBAX Newbie texasalynn's Avatar
    Joined
    Jun 2004
    Location
    Houston
    Posts
    2
    Location

    Solved: Solved-Format Phone Number

    I've searched for this but haven't found the right word match.

    I need to have a macro that looks at the phone number and format it. For example I have this:

    [vba]
    ( 666 ) 222 - 2222
    999/333-3333
    [/vba]
    I want all the phone numbers to look like the 1st one. But not sure how to go about it. Would appreciate suggestions/help.

    ---------------------------------
    I figured it out
    [VBA] For i = 2 To WSC
    Phone = Cells(i, 40).Value
    If Left(Phone, 1) = "(" Then
    ' leave info unchanged
    Else
    Cells(i, 40).Value = "( " & Left(Phone, 3) & " ) " & Mid(Phone, 5, 3) & " - " & Right(Phone, 4)
    End If
    Next i
    [/VBA]
    Last edited by texasalynn; 08-01-2006 at 09:50 AM. Reason: text layout

  2. #2
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    If its in a cell you can right click on the cell, select format cells
    then under the number tab at the top of the dialog select special and phone number. enter your ten numbers without hyphens etc.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Newbie texasalynn's Avatar
    Joined
    Jun 2004
    Location
    Houston
    Posts
    2
    Location
    thanks for the help

    I solved it and edited my original post. I'm not sure how to mark the post as "Solved"

  4. #4
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    sorry, misunerstood..
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    use the thread tools at the top of the page
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

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