![]() |
Code to do complete a Find and Replace on long list of values
Hello - I have a pretty straightforward set of steps that I was hoping someone could help me write a macro for.
The content includes: (1) a list of alphanumeric values in Sheet1, columnA (the range is variable, and can be as many as several hundred thousand values). (2) A series of phrases to Find and Replace in Sheet 2, located in columns A and B (i.e., column A is the 'Find value' and column B is the 'Replace' value (3) In some instances the goal is to Replace the value with nothing at all (i.e., to delete those characters wherever they exist in Sheet1!A:A), so in that case there is no value in the adjacent cell in column B of Sheet2. The list of steps is as follows: 1. Begin with Sheet2!A2. Find this value in any part of a cell in the list of data in Sheet1!Column A (many instances will exist). Replace those Values with Sheet2!B2. Now just move down the list. 2. Move to sheet2!A3 (i.e., move down 1 cell). Find this value in any part of a cell in the list of data in Sheet1!Column A (many instances will exist). Replace those Values with Sheet2!C2. Etc. 3. Eventually there will be no more values to look up in Sheet2, column A. (note that in some instances there will be no value in column B of sheet 2, so if it is easy enough, the macro could simple "Delete" that value since it will be replacing the selection with "nothing". Here is a simple example: Sheet2!Column A Sheet2!ColumnB apple orange If any cell in Sheet1!A:A contains a value with "apple" it would be replaced with "orange:. So if Sheet1!A243 contains the value "apple juice" initially, it would read "orange juice" after the routine is complete. Thanks for any help you can provide! |
Code to do complete a Find and Replace on long list of values
Hi Fred,
Am Fri, 19 Jun 2015 07:41:19 -0700 (PDT) schrieb James: Hello - I have a pretty straightforward set of steps that I was hoping someone could help me write a macro for. I answered in the other group Regards Claus B. -- Vista Ultimate / Windows7 Office 2007 Ultimate / 2010 Professional |
All times are GMT +1. The time now is 01:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com