ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   #DIV/0! error using VB (https://www.excelbanter.com/excel-programming/277822-div-0-error-using-vbulletin.html)

Bruce Brosek

#DIV/0! error using VB
 
I populated an entire column using

ActiveCell.FormulaR1C1 = "=(RC[-5]/RC[-1])*52"

and some of the results equate to #DIV/0! based on RC[-1].

I want to read each cell for a variable amount of rows in
a single column, and if the value of RC[-1] is zero, force
the current cell to zero. This would eliminate the divide
by zero from displaying. The above activecell statement
calculates the entire column with 1 statement instead of
looping.

Thanks,

Niek Otten

#DIV/0! error using VB
 
ActiveCell.FormulaR1C1 = "=if(RC[-1]=0,0,(RC[-5]/RC[-1])*52)"

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Bruce Brosek" wrote in message
...
I populated an entire column using

ActiveCell.FormulaR1C1 = "=(RC[-5]/RC[-1])*52"

and some of the results equate to #DIV/0! based on RC[-1].

I want to read each cell for a variable amount of rows in
a single column, and if the value of RC[-1] is zero, force
the current cell to zero. This would eliminate the divide
by zero from displaying. The above activecell statement
calculates the entire column with 1 statement instead of
looping.

Thanks,




bruce

#DIV/0! error using VB
 
Worked perfect, thank you very much!

Bruce

-----Original Message-----
ActiveCell.FormulaR1C1 = "=if(RC[-1]=0,0,(RC[-5]/RC[-1])

*52)"

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Bruce Brosek" wrote in

message
...
I populated an entire column using

ActiveCell.FormulaR1C1 = "=(RC[-5]/RC[-1])*52"

and some of the results equate to #DIV/0! based on RC[-

1].

I want to read each cell for a variable amount of rows

in
a single column, and if the value of RC[-1] is zero,

force
the current cell to zero. This would eliminate the

divide
by zero from displaying. The above activecell statement
calculates the entire column with 1 statement instead of
looping.

Thanks,



.



All times are GMT +1. The time now is 04:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com