How do I assign values from one arrangement to another?

0

I want to make a function that gives me back a specific position of an array of a smaller length with respect to another one in VBA - Excel, all my values are multiples of 28 and I had this idea in mind:

Public Function arreglo_corto(rango As Range, termino As Integer) As Double

Dim i, j As Integer
Dim curva As Double
ReDim curva(390)


For i = 1 To 390
  j = i * 28
  curva(i) = rango(j)
Next i


arreglo_corto = curva(termino)


End Function

But nothing else returns the error '# REF!', could you help me to a clearer solution or to tell me what I'm wrong about?

Thanks:)

    
asked by werlix 17.02.2018 в 00:21
source

0 answers