|
Microsoft Office Application Development
|
|
Wrapping Formulas In An Error TestFirst versionOftentimes I have a range filled with formulas that as such work correctly, but need an error checking mechanism. Take for example the following simple situation: If you don't want the errors to show, the solution is simple: test for zero: =IF(A3=0,"",B3/A3) But I tend to have much more complicated formulas, in which it is not always just one cell that might cause an error of some sort, so I need to wrap the entire formula in an error check. I thought it might be useful to have a generic little tool that lets you specify how to wrap the current function in a cell with an error test. Here is the first try at a subroutine: Sub ChangeFormulas() So how does this work? You select the cells with the formulas that need worked over. =IF(ISERROR(_form_),"",_form_) What this means is that the current formula in the cell is going to be placed at each location where it says "_form_". Edit the formula template to match your need and click OK. Because sFormulaTemplate is declared as Static, the utility remembers the template for a next time you use it. | ||||||||||||||
|
Use the contact page to issue
questions or comments about this website. |