Results 1 to 2 of 2

Thread: Find text and replace

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    8
    Rep Power
    0

    Find text and replace

    As part of an Excel macro, I'm trying to find if a string has a specific word in it and then, if it does, copy the string to another cell without some of the words in the cell.

    I've tried this (below) which works ok, BUT if the address you see below is not EXACTLY the same which is often the case with a moved space or a deleted comma etc, the trim function will not work of course. I know there must be a way to do some kind of wildcard solution, but darned if I can figure it out.

    Here's what I've tried so far:
    Code:
    grape = Cells(mirow, micol)
    Code:
    If InStr(grape, "San Ramon") Then
    bk = Trim(Replace(grape, "(211 Old Crow Canyon Rd#19, San Ramon Ca 94583)", " "))
    Cells(mirow, micol +1) = bk 


    I've posted this to another site but cannot figure out how to get a link.
    Last edited by Admin; 12-12-2017 at 08:30 AM.

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. Replies: 6
    Last Post: 08-11-2014, 05:41 PM
  2. Replies: 7
    Last Post: 03-11-2014, 05:38 PM
  3. Find keyword using multiple Text box and combox value
    By Ryan_Bernal in forum Excel Help
    Replies: 2
    Last Post: 03-07-2013, 06:11 PM
  4. Replies: 2
    Last Post: 09-25-2012, 01:30 AM
  5. Find the First or Last So Many Words in a Text String
    By Rick Rothstein in forum Rick Rothstein's Corner
    Replies: 6
    Last Post: 06-21-2012, 09:42 PM

Tags for this Thread

Posting Permissions

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