I am copying and pasting a formula into column I rows 4 thru predetermined count of DBF records.
The constants are :
#DEFINE xlSum -4157
#DEFINE xlFillDefault 0
#DEFINE xlAutoFill 4
#DEFINE xlPasteFormulas -4123
#DEFINE xlPasteValues -4163
#DEFINE xlNone -4142
.Range("I4").Select
.ActiveCell.FormulaR1C1 = "=RC[-1]/RC[-2]"
.Range("I4").copy
.Range("I4:I"+ALLTRIM(STR(vfincount+4))).Pastespecial
This code works wonderful but I get the dreaded #DIV/0! where RC[-2] = 0
I am thinking the formula has to be defined like this:
IF(RC[-2]=0,"","=RC[-1]/RC[-2]")
but of course it doesn't work.
Does anyone know how to avoid the #DIV/0! ?
John O'D
The constants are :
#DEFINE xlSum -4157
#DEFINE xlFillDefault 0
#DEFINE xlAutoFill 4
#DEFINE xlPasteFormulas -4123
#DEFINE xlPasteValues -4163
#DEFINE xlNone -4142
.Range("I4").Select
.ActiveCell.FormulaR1C1 = "=RC[-1]/RC[-2]"
.Range("I4").copy
.Range("I4:I"+ALLTRIM(STR(vfincount+4))).Pastespecial
This code works wonderful but I get the dreaded #DIV/0! where RC[-2] = 0
I am thinking the formula has to be defined like this:
IF(RC[-2]=0,"","=RC[-1]/RC[-2]")
but of course it doesn't work.
Does anyone know how to avoid the #DIV/0! ?
John O'D