Consulting

Results 1 to 4 of 4

Thread: How to get Last Digit from Text

  1. #1
    VBAX Regular
    Joined
    Apr 2009
    Posts
    32
    Location

    How to get Last Digit from Text

    Hello Experts

    I have below data, now i need Last Digit from the Text,the problem is its not always 1 or 2 or 3 Digit, sometime its 1 , sometimes its 25 and might be 398 or 11259

    Second problem ,before every digit sometime it have Spaces and sometime not (See the Attached)

    Text Expected Result
    10006-R K Mahajan Entprs,100 MON 11172 S.inv 285 285

    Actually they are Invoice No. and this data it's only the unique number, which i can map with my data


    Can you please help me on this
    Attached Files Attached Files

  2. #2
    VBAX Expert
    Joined
    Sep 2016
    Posts
    788
    Location
    Function getINV(txt As String) As Long
        
        With CreateObject("VBScript.RegExp")
            .Pattern = "[0-9]*$"
            getINV = .Execute(txt)(0)
        End With
        
    End Function

  3. #3
    VBAX Regular
    Joined
    Apr 2009
    Posts
    32
    Location
    m Getting Error
    #NAME?

    =Getinv(A2)


  4. #4
    VBAX Regular
    Joined
    Apr 2009
    Posts
    32
    Location
    Sorry Mana

    Its my fault, it work thanks a lot

Posting Permissions

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