Hi. My first time posting. I require help with a VBA macro.
I have Range names in a workbook that I refer to in formulas in excel cells. One of the range names is “production”. The other range name is “production.cubic.feet”.
I want to add a suffix ( _copy) to these names using some kind of universal find and replace (because I have lots of these).
For example:
=production*2 change to =production_copy*2
=production.cubic.feet*6 change to =production.cubic.feet_copy*6
The suffix always needs to go at the end.
The issue is that when I do a universal replace of “production” with “production_copy” (which works for the first reference), “production.cubic.feet” unintentionally becomes “production_copy.cubic.feet” because it contains the string “production” and the suffix is then no longer at the end. Because this name does not exist I get a #name? error.
How can I add a suffix to the in cell name reference “production” without impacting other cells that include the string “production” as part of longer name references?
Any help will be greatly appreciated! I would like to automate this procedure as I need to do it on many occasions.
Thanks!
Daniel
I have Range names in a workbook that I refer to in formulas in excel cells. One of the range names is “production”. The other range name is “production.cubic.feet”.
I want to add a suffix ( _copy) to these names using some kind of universal find and replace (because I have lots of these).
For example:
=production*2 change to =production_copy*2
=production.cubic.feet*6 change to =production.cubic.feet_copy*6
The suffix always needs to go at the end.
The issue is that when I do a universal replace of “production” with “production_copy” (which works for the first reference), “production.cubic.feet” unintentionally becomes “production_copy.cubic.feet” because it contains the string “production” and the suffix is then no longer at the end. Because this name does not exist I get a #name? error.
How can I add a suffix to the in cell name reference “production” without impacting other cells that include the string “production” as part of longer name references?
Any help will be greatly appreciated! I would like to automate this procedure as I need to do it on many occasions.
Thanks!
Daniel