Closed Thread
Results 1 to 3 of 3

Substituting text

  1. #1
    Registered User
    Join Date
    11-26-2008
    Location
    New England
    MS-Off Ver
    2007
    Posts
    35

    Substituting text

    I have several possible variations of text I need to standardize as I'm updating files.

    For example:
    In different files, cell I5 may contain "apple dapple" , "sour apple", "apple pie" or "apple strudel". (The placement of the text may vary withing the cell...)

    As I loop through the files updating, I want any files that have a variation of this to have it replaced with "apple", because later the in the code the cell contents are used to create a folder and in a saveas function.

    I tried this, but no luck:
    Please Login or Register  to view this content.
    All I need if how to replace this, I've got the other steps ready to go...

    THanks
    Ted

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    check out "Like" operator in VB Help - that should do it for you...
    (you could also in theory use InStr)

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Ted,

    To catch all occurrences of the word "apple", you need to use Regular Expressions. This example checks for word apple with a trailing space, space before and after, and a space before it at the end of sentence or word group.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

Closed 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