Results 1 to 4 of 4

leaving only numbers in the cell

Threaded View

marreco leaving only numbers in the... 06-24-2012, 08:34 AM
martindwilson Re: leaving only numbers in... 06-24-2012, 08:48 AM
marreco Re: leaving only numbers in... 06-24-2012, 09:02 AM
tigertiger Re: leaving only numbers in... 06-24-2012, 09:09 AM
  1. #1
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    leaving only numbers in the cell

    Hi.

    I need to remove bars, dashes, commas, at once inside a cell.
    Exemple:
    ----Original---------------Result
    25.569.589/0001-68--25569589000168

    i try ...don't work....# VALUE!

    Function GetNum(strIn As String) As Integer
    'Separa número de texto
        Dim objRegex
        Dim i As Integer
        Dim j As Integer
        
        Set objRegex = CreateObject("vbscript.regexp")
        
        With objRegex
         .Global = True
         .Pattern = "[^\d]+"
        GetNum = .Replace(strIn, vbNullString)
        End With
        
    End Function
    Last edited by marreco; 06-24-2012 at 09:02 AM.
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

Thread Information

Users Browsing this Thread

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

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