It does not matter whether you pass one cell or many cells, the .Value property is used to get the value. In the sub that does the work, it gets the first cell in the passed Range of cells by:
Since your replace range had cells that were merged, one has to do this sort of thing. I just did it for the Find range as well just to be on the safe side. Had I been sure that it would never be a merged cell, it could have been:
If you are going to concatenate strings, use "&" rather than "+". If you want to set just one find and one replace string, my linked example will do the job. You would need to get the first merged cell if you are getting a merged cell value as I did of course. Use the Immediate window in VBE and type your concatenation string with a ? as the first character and press enter. It is a quick debugging method.
If you want to Find/Replace multiple times and not use my SearchMReplaceInDoc() routine, then you need another method as I explained early in this thread. Arrays, Dictionary methods, Collections, Delimited strings are just a few of the methods one can use. Of course that would require a modification to SearchMReplaceInDoc().
Bookmarks