+ Reply to Thread
Results 1 to 24 of 24

Find and replace

  1. #1
    Registered User
    Join Date
    05-30-2009
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    22

    Find and replace

    I am a novice in excel so please bare with me.

    I was wondering if it is possible to do this unique find and replace that is explained below.

    I have many columns with data from our database. I have one column that has my html layout in it. I want to find within the html text data and replace it with data from another column for that row.

    Example: We have [[manufacturer]] in the html area that we want to replace with data from our column called Manufacturer. So, it will replace the text in the html named [[Manufacturer]] with that rows Manufacturer data we have.

    Is that possible to do?
    Last edited by lnjsports; 06-10-2009 at 11:07 AM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    re: Find and replace

    Hi Injsports,

    I'd recommend uploading a copy of your workbook (minus any sensitive data) so we can take a look. In the workbook be sure to have an example (or a few) of what your data looks like now, and how you want it to look afterward.

    Thanks!

  3. #3
    Registered User
    Join Date
    05-30-2009
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    22

    re: Find and replace

    Thank for replying to my post to see if this is possible.

    I attached a two row sample of my data. My full workbook is very large with over 10,000 items with a lot more columns then what is showing. I just deleted a lot of the columns that are not really associated with what my request is about.

    If you look at the column (C) Template, you will see the sample template html that I provided. In the html, you will see text with [[ ]] around text. That is the text that I would like to replace with data from the associated column. ( [[PRODUCT_NAME]] with PRODUCT_NAME data ) I want to do this for each [[ ]] in the template html.

    Does this make sense?
    Attached Files Attached Files

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    re: Find and replace

    Maybe like this:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

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

    Re: Find and replace

    Please Login or Register  to view this content.
    sort of works but its nor easy to see.
    youd be better of using mail merge with word using excel as your source to do this.
    word is far better for this html editing than excel
    "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

  6. #6
    Registered User
    Join Date
    05-30-2009
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Find and replace

    Thank you SHG for that information. Please remember what I stated at the start of the topic. I am an novice here. I know that for many if not all other members here, they totally understood what that code means and does, but, I just said, WOW!

    How would I go about in performing the code you just suggested.

  7. #7
    Registered User
    Join Date
    05-30-2009
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Find and replace

    Mail Merge? Never used it.

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

    Re: Find and replace

    well if you using office you should really look into using word and mailmerge, part of the same toolbox really!!!!!!!
    essentially put template in word , make all those bits in [[ ]] merge fields and it would pull the data from excel
    creating a nice page of html from each row in excel
    Last edited by martindwilson; 06-09-2009 at 08:40 PM.

  9. #9
    Registered User
    Join Date
    05-30-2009
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Find and replace

    Thank you MartinD,

    I just tested out the Mail Merge which it did do what I wanted for giving me the HTML with all fields filled in. BUT, how do I associate each new html with that row on my excel file?

    Basically I want to have the template column or even a new column with the new html in it because then I have to use some of the columns not shown with the new html in an upload.

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

    Re: Find and replace

    ah ! i was assuming you just needed to generate the html and would use the word doc for upload.

  11. #11
    Registered User
    Join Date
    05-30-2009
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Find and replace

    That mail merge did do the trick of what I wanted but then I would have over 10,000 of this html in word that I would have to manually put back into my excel file.

    So, since that will not work, are there any other possible ways?

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

    Re: Find and replace

    trouble is its so large you cant see whats in it because the formula bar view goes over it!
    but ive had a look and if you put function i posted earlier in template cell and drag down it should work
    the attached word doc shows whats cell c2(page1) and c3 (page2) after puting function in c2 and dragging down
    Attached Files Attached Files
    Last edited by martindwilson; 06-09-2009 at 10:17 PM.

  13. #13
    Registered User
    Join Date
    05-30-2009
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Find and replace

    WOO HOO!

    I finally figured out to use the code that SHG gave me above to make it work.

    With the code that he supplied, do I need to set up a newly edit module for every find and replace I do? Or is there a code that would do all of them?

  14. #14
    Registered User
    Join Date
    05-30-2009
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Find and replace

    Hey SHG,

    That code really worked great for the sample you gave me. I then tried editing the code to do another column but it came up with an error. I was doing the [[Description]] text with the column (D) Description. The column has some html style text in it. I am not sure if that matters.

    This is the code I edited for that one:
    Please Login or Register  to view this content.

  15. #15
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Find and replace

    Post the workbook that doesn't work.

  16. #16
    Registered User
    Join Date
    05-30-2009
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Find and replace

    Hello SHG,

    I posted the workbook above in my second post.

  17. #17
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Find and replace

    I already tested the code I posted against the workbook you originally posted, and it worked fine.

    Post one that doesn't work.

  18. #18
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Find and replace

    Shg, I think he wants to figure out why his new code doesn't work. He tried to amend it to look at a different description or column.

  19. #19
    Registered User
    Join Date
    05-30-2009
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Find and replace

    SHG,

    Yes, the code works for all the different column changes but not for the one for [[Description]] to be replace with column D (description)

    This is the code I used.

    Please Login or Register  to view this content.
    When I run it, I get run time error 13

  20. #20
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Find and replace

    Thank you, Paul.

    Try this:
    Please Login or Register  to view this content.

  21. #21
    Registered User
    Join Date
    05-30-2009
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Find and replace

    SHG,

    You are a god! That worked perfectly! BUT, there is one issue though. On the second row, it only replaced part of the data that was in the column D.

    It looks like that maybe it is limited in how many characters it does. Could that be the case?

  22. #22
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Find and replace

    Sorry -- try this:
    Please Login or Register  to view this content.

  23. #23
    Registered User
    Join Date
    05-30-2009
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Find and replace

    YOU ARE AWESOME! Works perfectly!

    I really do appreciate your time and efforts in helping me.

    I did learn a great deal on this as well.

  24. #24
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Find and replace

    You're welcome. Would you please mark the thread as Solved?

+ 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