G
ghobbit
Hi
I had a problem with a #DIV/0! error and was given some code here that
works very well on the cell it is aimed at, but I was wondering how I
could tweak it so that it would work across a range.
The code is this
Cells(9: "AL").Value = Evaluate("IF(AE9+AC9=0,0,SUM((AE9
/(AE9+AC9))*100))")
As I say this works well, however I have 10 or more different
calculations using variations on the above formula any one of which
could result in the denominator equaling zero. The answer to each of
those calculations are put into a different cell ranging from AL9 to
AS9. I could paste the code above 10times changing the different cell
values in the calculations but is there a simple one line or two piece
of code that will allow me to apply the above formula to a range of
cells in one go. That is it performs all its calculations and then runs
the next bit of code that checks the range AL9 to AS9 and if it finds a
#DIV/0! in the cell it'll change it to 0 (preferably) or even blank.
I've looked at
Range("AF9:AL9").Value = Evaluate("IF(AE9+AC9=0,0,SUM((AE9
/(AE9+AC9))*100))")
Which will put zero in that range but only if AE9+AC9=0 and as I say
each cell contents is based on a different calculation. I've looked at
ERROR.TYPe or IsError type things and I'm just not getting anywhere.
Any help would be greatly appreciated
regards
Steve
I had a problem with a #DIV/0! error and was given some code here that
works very well on the cell it is aimed at, but I was wondering how I
could tweak it so that it would work across a range.
The code is this
Cells(9: "AL").Value = Evaluate("IF(AE9+AC9=0,0,SUM((AE9
/(AE9+AC9))*100))")
As I say this works well, however I have 10 or more different
calculations using variations on the above formula any one of which
could result in the denominator equaling zero. The answer to each of
those calculations are put into a different cell ranging from AL9 to
AS9. I could paste the code above 10times changing the different cell
values in the calculations but is there a simple one line or two piece
of code that will allow me to apply the above formula to a range of
cells in one go. That is it performs all its calculations and then runs
the next bit of code that checks the range AL9 to AS9 and if it finds a
#DIV/0! in the cell it'll change it to 0 (preferably) or even blank.
I've looked at
Range("AF9:AL9").Value = Evaluate("IF(AE9+AC9=0,0,SUM((AE9
/(AE9+AC9))*100))")
Which will put zero in that range but only if AE9+AC9=0 and as I say
each cell contents is based on a different calculation. I've looked at
ERROR.TYPe or IsError type things and I'm just not getting anywhere.
Any help would be greatly appreciated
regards
Steve