+ Reply to Thread
Results 1 to 8 of 8

Search and Remove Exact String

  1. #1
    Registered User
    Join Date
    08-04-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    9

    Search and Remove Exact String

    I am having a little trouble figuring out how to find a string on one sheet and delete that exact string in another column on another sheet. The problem I'm having is say I want to delete D12, the script finds D12 in D120 and deletes the D12 part of D120 leaving just the 0. I only want to delete the string D12, and leave the string D120 alone. If I could get some help that would be great. Here is the code that I have. It searches on Sheet3, starting at A2 going down column A and finds the string located in column G in sheet 2.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Search and Remove Exact String

    what are the two similar strings?
    you can often replace say d12{space} rather than just d12
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Search and Remove Exact String

    I believe if you change
    lookat:=xlpart
    to
    lookat:=xlwhole

    that will do what you want.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Search and Remove Exact String

    not if the string is xxxx d12 yyyyyyyy and the other is wwwww d120 ggggggg nothing would get replaced

  5. #5
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Search and Remove Exact String

    @Martin,

    Wrongly or rightly, I took "that exact string" to mean, "D12" entered in a cell.

  6. #6
    Registered User
    Join Date
    08-04-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Search and Remove Exact String

    Quote Originally Posted by yudlugar View Post
    I believe if you change
    lookat:=xlpart
    to
    lookat:=xlwhole

    that will do what you want.
    Sorry I should have explained better. There will be multiple designators in the cells i'm looking in. So, the cell would include something like D12 D20 D3 etc...
    So that command won't work bc whole looks at the whole cell value

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Search and Remove Exact String

    did you try find d12[space] replace with [space]

  8. #8
    Registered User
    Join Date
    08-04-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Search and Remove Exact String

    Quote Originally Posted by martindwilson View Post
    did you try find d12[space] replace with [space]
    That worked thank you very much. I just realized I had that in my code before, but somehow it got taken out when I changed something. Thanks for the help.

+ 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. Search for EXACT string
    By jarochnrol in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2011, 11:39 AM
  2. Search Multiple Worksheets Against List of Non-Exact Search Criteria?
    By thump4r in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-17-2010, 03:46 PM
  3. How to filter exact string within another string???
    By ray1202 in forum Excel General
    Replies: 2
    Last Post: 08-31-2010, 07:47 PM
  4. exact search string type question
    By Noel Reichel in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 09-18-2007, 05:16 PM
  5. [SOLVED] a exact string search inquiry
    By vito in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-10-2006, 09:10 AM

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