That isn't the only division you do - the very next line does it too:
Code:
         sngYNumInc = (sngYMax - sngYMin) / iYAxisHeight
         iReturn = (sngYMax - YValue) / sngYNumInc
..so when sngYMax and sngYMin are equal (or very close to it), sngYNumInc will be 0 and cause the error on the next line.


This is one of those situations where line numbers should make corrections much easier.