A
AJ Master
All,
I'm having trouble trying to debug why variables defined as double and
used in calculations appear with only 2 decimal places when placed in
the cell. Here is some of the code.
..
..
..
Dim dblOpEx, dblCurrent, dblAddOnExp, dblPctInc As Double
Dim iBY, iAY, i, j As Double
iAY = ActiveSheet.Range("ad536")
iBY = ActiveSheet.Range("ad537")
dblOpEx = ActiveSheet.Range("ad538")
dblPctInc = ActiveSheet.Range("ad539")
dblCurrent = ActiveSheet.Range("ad540")
dblAddOnExp = ActiveSheet.Range("ad542")
For j = 0 To iRowCount + iEmptyCount - 1
If j < iEmptyCount Then
ActiveCell.Offset(j, 1).Value = 0
Else
If iBY > Year(ActiveCell.Offset(j, -6)) Then
ActiveCell.Offset(j, 1).Value = dblCurrent
Else
ActiveCell.Offset(j, 1).Value = (dblCurrent +
dblAddOnExp) * (1 + dblPctInc) ^ (Year(ActiveCell.Offset(j, -6)) -
iAY)
End If
End If
Next j
The cell value of dblcurrent is 9.025004, but when it enters it in
cells BI704 thru BI717 it rounds it to 9.03 and this causes
calculation errors. Any idea why this is happening?
Any thoughts would be appreciated.---AJ
I'm having trouble trying to debug why variables defined as double and
used in calculations appear with only 2 decimal places when placed in
the cell. Here is some of the code.
..
..
..
Dim dblOpEx, dblCurrent, dblAddOnExp, dblPctInc As Double
Dim iBY, iAY, i, j As Double
iAY = ActiveSheet.Range("ad536")
iBY = ActiveSheet.Range("ad537")
dblOpEx = ActiveSheet.Range("ad538")
dblPctInc = ActiveSheet.Range("ad539")
dblCurrent = ActiveSheet.Range("ad540")
dblAddOnExp = ActiveSheet.Range("ad542")
For j = 0 To iRowCount + iEmptyCount - 1
If j < iEmptyCount Then
ActiveCell.Offset(j, 1).Value = 0
Else
If iBY > Year(ActiveCell.Offset(j, -6)) Then
ActiveCell.Offset(j, 1).Value = dblCurrent
Else
ActiveCell.Offset(j, 1).Value = (dblCurrent +
dblAddOnExp) * (1 + dblPctInc) ^ (Year(ActiveCell.Offset(j, -6)) -
iAY)
End If
End If
Next j
The cell value of dblcurrent is 9.025004, but when it enters it in
cells BI704 thru BI717 it rounds it to 9.03 and this causes
calculation errors. Any idea why this is happening?
Any thoughts would be appreciated.---AJ