+ Reply to Thread
Results 1 to 4 of 4

How do I replace last numeric string from a alphanumeric string?

  1. #1
    Christy
    Guest

    How do I replace last numeric string from a alphanumeric string?

    For example,
    I want to replace "1055428" from CC03TW05040000010001055428 with "1162123",
    so that my string would be CC03TW05040000010001162123.

    Thanks!

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Say

    A1 = CC03TW05040000010001055428
    B1 = 1162123

    then enter C1

    =LEFT(A5,LEN(A5)-LEN(B5))&B5

    VBA Noob

  3. #3
    Zamdrist
    Guest

    Re: How do I replace last numeric string from a alphanumeric string?

    Christy wrote:
    > For example,
    > I want to replace "1055428" from CC03TW05040000010001055428 with "1162123",
    > so that my string would be CC03TW05040000010001162123.
    >
    > Thanks!


    Is the last set of characters consistently 7 characters? If so...

    sString = Left("CC03TW05040000010001055428",
    Len("CC03TW05040000010001055428") -7) & "1162123"

    "1162123" could be a variable or a field value too.

    If it is not consistently 7 characters...maybe 1000 is? In which case
    you could use the Mid function.

    Steve


  4. #4
    Christy
    Guest

    RE: How do I replace last numeric string from a alphanumeric string?



    Bingo!
    Thanks a lot guys. You guys are incredible.

+ Reply to Thread

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