+ Reply to Thread
Results 1 to 14 of 14

VBA to Replace looked up values on Multiple worksheets

  1. #1
    Registered User
    Join Date
    12-13-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    68

    VBA to Replace looked up values on Multiple worksheets

    HI..
    Can someone help me with a bit of VBA. I have tried working out codes on the attachment but I have very, very little knowledge of it so am stuck.

    I currently have a workbook with several worksheets and on the main worksheet called ‘CUSTOMER_INFORMATION’ (see attached example) I want to replace German words with English equivalent where they match with the list in LANG_Conversion (Column A is formula based values).

    For code that I started - See macro called “ChangeTo_English”

    Thanking you in advance.
    Warm Rgds
    Dhiresh
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA to Replace looked up values on Multiple worksheets

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-13-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    68

    Re: VBA to Replace looked up values on Multiple worksheets

    Hi John,
    Thx for the code but when transfered to my live file it does not work and the line ws.UsedRange.Replace Range("E" & i).Value, Range("C" & i).Value highlighted in yellow.

    One point to make here is that my files contains certain cells that are Merged. Would this cause an issue?

    Rgds
    Dhiresh

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA to Replace looked up values on Multiple worksheets

    Yes. My experience merged cells always cause a problem. I don't know of a work around either.

  5. #5
    Registered User
    Join Date
    12-13-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    68

    Re: VBA to Replace looked up values on Multiple worksheets

    I have de-merged cells and tried but am having the same issue.

    Can you suggest what can I do to overcome this problem

    Dhiresh

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA to Replace looked up values on Multiple worksheets

    Did you change the Sheet name. In Post 1 you call it "CUSTOMER_INFORMATION", however in your sample you call it "ORIGINAL_INFO". The code provided worked for me on the sample.

  7. #7
    Registered User
    Join Date
    12-13-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    68

    Re: VBA to Replace looked up values on Multiple worksheets

    Hi John,
    yes. I amended the VBA but could not get it to work on the actual file. I am attaching the file that gives more realistic view and on this file I want to have texts in cells (CUSTOMER_INFORMATION TAB) C12 to C79, F14, F18 to F31 and so on coverted to appropriate English translations from LAND_CONVERSION sheet where A3 to A75 are formula that determines the words. Cell B1 is a dropdown to select which language to apply.

    Hope you are able to assist.

    many thanks

    dhiresh
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA to Replace looked up values on Multiple worksheets

    I only changed the sheet names and used Column A vrs Column C on LAND_CONVERSION. I tested it on your current sample and it seems to work.

    Please Login or Register  to view this content.

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

    Re: VBA to Replace looked up values on Multiple worksheets

    as an option (see attachment)
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    12-13-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    68

    Re: VBA to Replace looked up values on Multiple worksheets

    Hi Nilem,

    The VBA on the attached file works and many thx for your assistance. This is much appreciated.

    However, my actual file contains details in other part of the CUSTOMER_INFORMATION tab and I do not want these to change. Secondly your code changes data up to row 71 and then gets stuck on line (highlights in yellow) - .Replace x(i, 1), y(i, 1), xlWhole. I have tried various ways to identifying what/where the problem is but am unsuccessful as I have very, very little knowledge of VBA.

    Would it be possible for you help change the code such that details in rows C12 to C71 and F14 to F71 only, update rather than the whole sheet.

    Look forward to hearing from you soon.

    regards

    Dhiresh

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

    Re: VBA to Replace looked up values on Multiple worksheets

    try
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    12-13-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    68

    Re: VBA to Replace looked up values on Multiple worksheets

    Hi Nilem,

    Excellent. Thank you for your help. the codes you supplied works on the test file but when I update the live file (which contains formulae, colours with texts and other validation references. the error is the same i.e. the code gets stuck on line (highlights in yellow) - .Replace x(i, 1), y(i, 1), xlWhole.

    Any idea what it could be?

    rgds
    Dhiresh

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

    Re: VBA to Replace looked up values on Multiple worksheets

    Can you show the file in which the error occurs?

  14. #14
    Registered User
    Join Date
    12-13-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    68

    Re: VBA to Replace looked up values on Multiple worksheets

    Hi Nilem
    Sorry I could not reply earlier but I have worked out where the problem is. I have adapted your VBA codes and it all works fine.
    I like to take this opportunity to thank you very much for your help.

    Rgds
    Dhiresh

+ 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