Function Koeff(strT As String, Grad As Byte)
Dim strZ As String, arrA, arrB() As Double, ii As Long
ReDim arrB(Grad)
strZ = Replace(Replace(strT, "+ ", "+"), "- ", "-")
If Left(strZ, 1) = "y" Then strZ = Trim(Right(strZ, Len(strZ) - 1))
If Left(strZ, 1) = "=" Then strZ = Trim(Right(strZ, Len(strZ) - 1))
arrA = Split(strZ, " ")
For ii = 0 To UBound(arrA)
Select Case InStr(arrA(ii), "x")
Case 0: arrB(0) = arrA(ii)
Case Len(arrA(ii)): arrB(1) = Left(arrA(ii), Len(arrA(ii)) - 1)
Case Else: arrB(Right(arrA(ii), 1)) = Left(arrA(ii), Len(arrA(ii)) - 2)
End Select
Next ii
Koeff = arrB
End Function
Function Koeff(strT As String, Grad As Byte)
Dim strZ As String, arrA, arrB() As Double, ii As Long
ReDim arrB(Grad)
strZ = Replace(Replace(strT, "+ ", "+"), "- ", "-")
If Left(strZ, 1) = "y" Then strZ = Trim(Right(strZ, Len(strZ) - 1))
If Left(strZ, 1) = "=" Then strZ = Trim(Right(strZ, Len(strZ) - 1))
arrA = Split(strZ, " ")
For ii = 0 To UBound(arrA)
Select Case InStr(arrA(ii), "x")
Case 0: arrB(0) = arrA(ii)
Case Len(arrA(ii)): arrB(1) = Left(arrA(ii), Len(arrA(ii)) - 1)
Case Else: arrB(Right(arrA(ii), 1)) = Left(arrA(ii), Len(arrA(ii)) - 2)
End Select
Next ii
Koeff = arrB
End Function