Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2002
    Location
    Bournemouth UK
    Posts
    1

    Cool Unanswered: Editing and updating string within string

    Im trying to update a section of a string and replace it with a different set of characters.

    The below data is carried in a table

    O2SLF3614852115B453002080721

    I require to manually update the 5th to 11th characters with a different set of characters and replace the new string in the same cell.

    I've played around with the Mid function and managed to isolate the data but no idea of how to further this.

    Any takers ?

    Thanks

    DaveH

  2. #2
    Join Date
    Aug 2002
    Location
    Québec, Canada
    Posts
    109
    Take a look at this code, you can use the mid$ to retrieve part of string AND to change it

    Code:
        Dim strTest As String
        
        'A sample string
        strTest = "abcdefghijklmnop"
        
        'Look at it
        MsgBox strTest
        
        'Change the 6 caracters starting at 5
        'It will only use the 6 first caracters of the string after the =
        Mid$(strTest, 5, 6) = "666666"
        
        'Look at it, it changed!! :)
        MsgBox strTest
    JefB - hope it helps

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    Will it always be the 5th - 11th positions ? Do you know the substring that needs to be replaced within the main string ?

Posting Permissions

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