Look at the values of X1 and Y1 as declared locally in the Sub DrawCurve(XYValues As Variant):
'Dim X1 As Double, Y1 As Double, X2 As Double, Y2 As Double'
now look at the values as passed to the subroutine:
XY = TernaryToXY(XYValues(i, 0), XYValues(i, 1))
where:
'Function TernaryToXY(x_A, x_B) As Variant'
which makes XY a variant..
Now deriving two 'double' values from a variant as follows:
X1 = XY(0)
Y1 = XY(1)
appears to be a possible cause of the error...
Bottom line is (the way I look at it) : What works OK is the correct syntax...
Mala Singh
'Dare to Imagine'