Hello,
I wanna achieve this:
in a more generic style like this
But I get a Type-Error
How could I get this to work? Thank you very much.
I wanna achieve this:
Code:
SliceArray= Worksheetfunction.Index(varArray, (Array(2, 4, 5), 0))
in a more generic style like this
Code:
Function SliceArray (p_lngStartRow as Long, p_lngEndRow as Long) as Variant
Dim varSubArr() as Variant
Dim i as Long
ReDim varSubArr(1 To (p_p_lngEndRow- p_lngStartRow) + 1)
'...
For i =Lbound(varSubArr) to Ubound(varSubArr)
varSubArr(i)= (p_lngIndexStart - 1) + i
Next i
' And then use varSubArr as Paramarray in the Worksheetfunction like this
SliceArray= Worksheetfunction.Index(varArray, 0, varSubArr))
End Function
But I get a Type-Error
How could I get this to work? Thank you very much.