+ Reply to Thread
Results 1 to 7 of 7

Find and Replace from a List

  1. #1
    Registered User
    Join Date
    08-23-2012
    Location
    Hemet, CA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Find and Replace from a List

    I need to create a macro that will find and replace the city name in a single sentence from a list of 975 names.

    I need the result to generate 975 sentences with the unique city name.


    How do i do this?

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Find and Replace from a List

    Hi, kgb951,

    why not use formulas to do this? You split up your sentence and leave the city name open and then put it together.

    simple example
    A1 has "Welcome to "
    B1 has " for the festival"

    Your list resides from A10 down. Put the following formula in B10:
    Please Login or Register  to view this content.
    Please mind the absolute references to A1 and B1.

    If itīs not what you are after please give some more details about where the lists resides as well as the sentence and where it shall be placed.

    Ciao,
    Holger

  3. #3
    Registered User
    Join Date
    08-23-2012
    Location
    Hemet, CA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Find and Replace from a List

    I need to replace the word city in this line of code:
    <a href="http://t.com/idx/?idx-q-Cities%3C0%3E=City">City Homes for Sale</a>

    As you can see, City occurs 2 times.

    I have a list of 975 city names. I want to generate this line of code 975 times each with a unique city name.

    Examples of city name:
    Jackson
    Jacumba
    Jamul
    Janesville
    Johnson Valley
    Jonesville
    Joshua Tree
    Julian
    June Lake

    How can this be done?

  4. #4
    Registered User
    Join Date
    05-18-2012
    Location
    Norwalk, CT
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Find and Replace from a List

    assuming the list of 975 cities is in column A and you want the sentences in column B


    Please Login or Register  to view this content.

    note: Use chr(34) for the " because if you include it normally, Excel will not know you want it as part of the string.

  5. #5
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Find and Replace from a List

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

  6. #6
    Registered User
    Join Date
    08-23-2012
    Location
    Hemet, CA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Find and Replace from a List

    I used niko's code and it worked! Thanks for much for your help guys!

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Find and Replace from a List

    @ kgb951

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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