texasalynn
08-01-2006, 08:53 AM
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:
( 666 ) 222 - 2222
999/333-3333
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
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
I need to have a macro that looks at the phone number and format it. For example I have this:
( 666 ) 222 - 2222
999/333-3333
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
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