+ Reply to Thread
Results 1 to 5 of 5

Replace multiple substrings in string

  1. #1
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Replace multiple substrings in string

    Hi all,

    I need to replace multiple 6 character substrings within a string. However, I do not know the last 2 characters of the substring. Hence, I tried using wildcards, but in vain as that doesn't seem applicable when using the replace function in VBA. I have heard of Regex objects, but that looks a little complex for such an 'easy' task.

    E.g.

    Please Login or Register  to view this content.
    Above illustrates what I am trying to achieve

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: Replace multiple substrings in string

    Quote Originally Posted by esbencito View Post
    Hi all,
    Above illustrates what I am trying to achieve
    No, just show us the result that you want.

  3. #3
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: Replace multiple substrings in string

    Fair enough...

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: Replace multiple substrings in string

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: Replace multiple substrings in string

    Thanks! That works very well! Still trying to understand the pattern references that you used, but overall, RegEx seems to be quite powerful and a good solution here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Replace substrings but keep constant overall string length
    By jveleke in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-17-2017, 03:51 PM
  2. [SOLVED] VBA to Find Multiple Substrings Within a String
    By learning_vba in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-06-2014, 07:35 AM
  3. [SOLVED] VBA substrings in string
    By mikejclark in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-28-2013, 08:36 AM
  4. Excel 2007 : Finding substrings in a string
    By kkerr in forum Excel General
    Replies: 4
    Last Post: 06-19-2012, 11:57 AM
  5. Changing multiple substrings within a string
    By RogueArchon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2012, 12:57 PM
  6. Substrings from String
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-23-2010, 05:08 PM
  7. Separtaing A String Into Substrings.
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 07-10-2005, 01:27 AM

Tags for this Thread

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