A function that returns a Range with entries reversed
Hi,
I made one here, maybe it's near what you want, The
function return the range in an array where the last row
is the first in the array.
Public Function ReturnArr(R As Range) As Variant
Dim Arr As Variant
Dim Arr2 As Variant
Dim Row As Long
Dim Col As Integer
Dim i As Integer
Arr = R
Arr2 = Arr
Row = 0
'Reverse the array
For i = UBound(Arr, 1) To 1 Step -1
Row = Row + 1
For Col = 1 To UBound(Arr, 2)
Arr2(Row, Col) = Arr(i, Col)
Next Col
Next i
ReturnArr = Arr2
End Function
To test it:
Public Sub Test()
Dim A As Variant
A = ReturnArr(Range(Cells(1, 1), Cells(4, 2)))
End Sub
-----Original Message-----
Would anyone have or be able to direct me to a function
that accepts a Range as input and then returns an Array
containing the entries in the Range in reverse order.
Thanks in advance
Ray Kanner
.
|