I have a formula for a spline function that I grabbed off the internets. It will only work if the input ranges and output ranges are columns.

I would really like to use this when inputs and outputs are in rows, but cant figure out how to make it work...Application.transpose() does not help either

any help would be greatly appreciated.

Function CHSplineA(Xa As Variant, Ya As Variant, Xint As Variant)

    Dim i As Long, n As Long, nInt As Long, Yint() As Double, j As Long, T As Double
    Dim L() As Double, S() As Double, M() As Double, H() As Double, Cubica() As Double
    Dim Alpha As Double, Beta As Double, Tau As Double

    If TypeName(Xa) = "Range" Then Xa = Xa.Value2
    If TypeName(Ya) = "Range" Then Ya = Ya.Value2
    If TypeName(Xint) = "Range" Then Xint = Xint.Value2

    n = UBound(Xa)
    nInt = UBound(Xint)

    ReDim L(1 To n - 1)
    ReDim S(1 To n)
    ReDim M(1 To n)
    ReDim H(1 To n)
    
    ReDim Yint(1 To nInt, 1 To 1)
    ReDim FinalVal(1 To nInt)
    ReDim Cubica(1 To n - 1, 1 To 4)

    i = 1
    L(i) = Xa(i + 1, 1) - Xa(i, 1)
    H(i) = Ya(i + 1, 1) - Ya(i, 1)
    S(i) = (H(i) / L(i))
    M(i) = S(i)
    For i = 2 To n - 1
        L(i) = Xa(i + 1, 1) - Xa(i, 1)
        H(i) = Ya(i + 1, 1) - Ya(i, 1)
        S(i) = (H(i) / L(i))
        M(i) = (S(i - 1) + S(i)) / 2
    Next i
    H(i) = H(i - 1)
    S(i) = S(i - 1)
    M(i) = S(i)

    For i = 1 To n - 1
        Cubica(i, 1) = 2 * (Ya(i, 1) - Ya(i + 1, 1)) + (M(i) + M(i + 1)) * L(i)
        Cubica(i, 2) = 3 * (Ya(i + 1, 1) - Ya(i, 1)) - (2 * M(i) + M(i + 1)) * L(i)
        Cubica(i, 3) = M(i) * L(i)
        Cubica(i, 4) = Ya(i, 1)
    Next i

    For i = 1 To nInt
        j = 0
        Do
            j = j + 1
        Loop While (Xint(i, 1) > Xa(j + 1, 1) And j < n - 1)
        T = (Xint(i, 1) - Xa(j, 1)) / L(j)
        
        FinalVal(i) = Cubica(j, 1) * T ^ 3 + Cubica(j, 2) * T ^ 2 + Cubica(j, 3) * T + Cubica(j, 4)
    Next i
    
    CHSplineA = FinalVal

End Function