+ Reply to Thread
Results 1 to 12 of 12

delete specific word from string

  1. #1
    Forum Contributor
    Join Date
    11-18-2007
    Posts
    111

    delete specific word from string

    Hi,
    I want to delete a specific words from string but i have a problem with the code below. For example, i wan to delete the word "Inc" only but the problem with my code is that it is deleting from "Incorporated" too and i want only the code to delete only if it finds the word "Inc" only. Thanks
    here is my code
    Please Login or Register  to view this content.
    Last edited by karinos57; 02-12-2009 at 08:30 PM.

  2. #2
    Forum Contributor
    Join Date
    11-18-2007
    Posts
    111

    Re: delete specific word from string

    Anyone...please help.
    I have searched in the forum but could not find what i need.

  3. #3
    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

    Re: delete specific word from string

    I assume you have a space after Inc so try

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Forum Contributor
    Join Date
    11-18-2007
    Posts
    111

    Re: delete specific word from string

    I have tried it is not working

  5. #5
    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

    Re: delete specific word from string

    So you don't have a space after INC then?

    Post a small sample workbook

    VBA Noob

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: delete specific word from string

    Having seen attachment, not the right answer.
    Last edited by StephenR; 02-12-2009 at 03:46 PM.

  7. #7
    Forum Contributor
    Join Date
    11-18-2007
    Posts
    111

    Re: delete specific word from string

    Thaks for your quick response. See attached per your request. I just want to delete the words like "Corp" or "Inc" etc.
    thanks for you time.
    Attached Files Attached Files

  8. #8
    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

    Re: delete specific word from string

    Try

    Please Login or Register  to view this content.
    VBA Noob

  9. #9
    Forum Contributor
    Join Date
    11-18-2007
    Posts
    111

    Re: delete specific word from string

    Noob,
    Your code works fine only when it is like this:
    3M Inc it gives me 3M so this is good
    But when i have something like this:
    Teleflex Medical Incorporated then it gives me Teleflex Medicalorporated
    Thank you for your help. See attached for more details.
    Attached Files Attached Files

  10. #10
    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

    Re: delete specific word from string

    That is why I asked you for an example.

    Will have a rethink

    VBA Noob

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: delete specific word from string

    Here's one possible approach:

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    11-18-2007
    Posts
    111

    Re: delete specific word from string

    This is exactly what i need. Thank all your help. This site is the best of the best.

+ 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