View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Faraz A. Qureshi Faraz A. Qureshi is offline
external usenet poster
 
Posts: 211
Default How to constract an array UDF?

That's the main reason bro!
What I need is to have some knowledge of how to create an array formula?
Simply a construction model not necessarily for Reversing prpose.
It was only an example.
Please c if u can help me in giving some other example of your own as to how
to construct an array formula?

Thanx again!
Looking 4ward 4 your guidance.

Best Regards,

Faraz


"Rick Rothstein" wrote:

I'm not sure why you would want a UDF to do what you already have a relatively compact formula doing, but here it is...

Function REVCOL(R As Range) As Variant
Dim CellValues As Variant, CallerRow As Long
CellValues = WorksheetFunction.Transpose(R)
CallerRow = Application.Caller.Row
REVCOL = CellValues(R.Count + R(1).Row - CallerRow)
End Function

Note that this is **not** an array formula... just commit it with the Enter key; and don't forget to make the range argument for it with absolute cell references so that when you copy the function down, the cell address doesn't "drift".

--
Rick (MVP - Excel)


"Faraz A. Qureshi" wrote in message ...
Sure would oblige if one would kindly provide the CODE for developing a UDF
for simple formula of reversing the column values like the following:

=OFFSET($A$1,ROWS($A$1:$A$20)-ROWS($B$1:B1),0)

Thus, if a UDF like the following, is entered in an array form:
{=REVCOL(A1:A20)}
on the range B1:B20, the B1:B20 would represent the data of A1:A20 but in
the reverse order.

Thanx in advance,
Best Regards,

Faraz

.