I have a worksheet with 2 named ranges:
MasterFormula
ModifiedFormula
My goal is to input a formula into the MasterFormula cell, enter a formula in the ModifiedFormula cell and then use a macro to modify all cells in the worksheet whose formula matches the pattern. As a simple example, let's say I'd like to add error suppression to a sum formula:
MasterFormula: =SUM(A2:B2)
ModifiedFormula: =IFERROR(SUM(A2:B2),0)
Goal: nest all SUM formulas in the worksheet that match this pattern:
SUM(REF:ADJACENT REF)
Skip:
SUM(#+#,REF)
SUM(REF,REF,#+REF) etc.
AVG(#+#,REF)
Find and replace won't do the trick as it will slavishly replace all references with the identical new references.
At this point, I'm looking for guidance and will build it myself if someone can help me figure out how to parse the various parts of a formula through VB. (ie function start, total number of supplied arguments, recognize which parts are ranges, etc.)
Bookmarks