Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A function that returns a Range with entries reversed

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
LOOKUP function reversed? Chris Excel Worksheet Functions 3 July 22nd 09 05:26 AM
"COUNTU" function in Excel to count unique entries in a range WayneL Excel Worksheet Functions 20 September 19th 08 03:50 AM
Linkage. Returns #N/A for certain entries Matts Excel Discussion (Misc queries) 3 October 2nd 07 01:08 PM
How to count dates within a certain range in a column with mutiple date range entries Krisjhn Excel Worksheet Functions 2 September 1st 05 01:59 PM
Need a function that finds a value in a table range and returns the cell number Tony Excel Programming 2 October 31st 03 05:49 PM


All times are GMT +1. The time now is 08:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"