I cannot understand why this UDF goes to currentInput = inputArray(i) . Here is the relevant code:
Function OrderRange(inputRange As Range) As Variant Dim length As Integer inputHeight = inputRange.Count Dim inputArray As Variant inputArray = inputRange Dim strippedArray() As Variant ReDim strippedArray(0 To (inputHeight - 1)) Dim currentInput As String Dim i As Integer For i = 0 To (inputHeight - 1) currentInput = inputArray(i) '...computations on currentInput...' strippedArray(i) = currentInput Next i OrderRange = strippedArray End Function
The debugger reaches currentInput = inputArray(i) , but as soon as I go to the next line, the function ends and the error #VALUE! is introduced into the cell with which I call the function #VALUE! . I know this is a specific question, but I'm sure this is a common problem, and I will edit this original post to reflect the general problem.
Edit: This is a range assignment problem for an array variant.
source share