Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-18-2017, 12:47 PM
tuaca12000 tuaca12000 is offline I have a question that I have not seen answered. Windows 7 32bit I have a question that I have not seen answered. Office 2013
Novice
I have a question that I have not seen answered.
 
Join Date: May 2017
Posts: 1
tuaca12000 is on a distinguished road
Question I have a question that I have not seen answered.

Can someone please point me to a forum that addresses this or if there is none, can someone please answer this question. I have a report that is sent to us as a .txt file that we then go in and copy to an Excel Spreadsheet. We then separate the columns using the Text to Columns feature. The question I have is that one of those columns contains a list of phone numbers in the following format (###)###-####. I need to see if it is possible to take that column and reformat it so that the parenthesis and the hyphen are no no longer in the string of numbers so that I just have the 10 digit number formatted like this: ##########. Please help. The only way I have been able to do this is to separate the phone numbers using the Text to Columns feature and place separators between the parenthesis and the numbers, and between the hyphen and the numbers, then go in and delete the columns that contain the parenthesis and the hyphen. However, that creates three distinct columns. I need a way for all 10 digits to be in one cell so that I can then copy and paste those numbers into another system.
Reply With Quote
  #2  
Old 05-18-2017, 01:18 PM
NBVC's Avatar
NBVC NBVC is offline I have a question that I have not seen answered. Windows 7 64bit I have a question that I have not seen answered. Office 2007
The Formula Guy
 
Join Date: Mar 2012
Location: Mississauga, CANADA
Posts: 215
NBVC will become famous soon enoughNBVC will become famous soon enough
Default

You can do a Find/Replace for each of those 3 characters within that column.
Reply With Quote
  #3  
Old 05-18-2017, 03:10 PM
Logit Logit is offline I have a question that I have not seen answered. Windows 10 I have a question that I have not seen answered. Office 2007
Expert
 
Join Date: Jan 2017
Posts: 587
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
.
Code:
Option Explicit

Sub CleanAll()
    Dim rng As Range

    For Each rng In Sheets("Sheet1").Range("A1:A15").Cells 'adjust sheetname and range accordingly
        rng.Value = AlphaNumericOnly(rng.Value)
    Next
End Sub
Function AlphaNumericOnly(strSource As String) As String
    Dim i As Integer
    Dim strResult As String

    For i = 1 To Len(strSource)
        Select Case Asc(Mid(strSource, i, 1))
            Case 48 To 57, 65 To 90, 97 To 122: 'include 32 if you want to include space
                strResult = strResult & Mid(strSource, i, 1)
        End Select
    Next
    AlphaNumericOnly = strResult
End Function

Paste the above into a Routine Module. Activate with a CommandButton on the
sheet in question.
Attached Files
File Type: xlsm Clean String.xlsm (17.4 KB, 9 views)
Reply With Quote
  #4  
Old 05-26-2017, 07:13 AM
riothecat riothecat is offline I have a question that I have not seen answered. Windows 10 I have a question that I have not seen answered. Office 2007
Novice
 
Join Date: Nov 2016
Posts: 27
riothecat is on a distinguished road
Default

after you do text to columns, in a cell next to your 3 cells of numbers, put =a1&b1&c1 (or whatever your 3 cells are) then delete the 3 cells of numbers.

GEBOB taught me that one.
Reply With Quote
Reply

Tags
formatting issue, phone number



Similar Threads
Thread Thread Starter Forum Replies Last Post
I have a question that I have not seen answered. Macro Needed to Insert Asnwer to A Question in Multiple Choice Format Question rsrasc Word VBA 7 03-28-2014 12:28 PM
Track un-answered emails ? antoinel Outlook 0 02-23-2011 05:36 AM
Need help with this question... lllDNYlll Outlook 0 05-04-2006 07:17 AM
Categories question & replying with attachment question glitzymama Outlook 0 03-15-2006 09:32 AM
Outlook 2002 deletes or moves answered messages Ken Winter Outlook 3 11-11-2005 10:53 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft