Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default ForumulaArrays - help needed.

Hi

I want to write a simple FormulaArray type function that will take a
Range as input, and return a value subect to where the cell is in
reference to the input range.

i.e. say a it was just to reverse the input

1 - 4
2 - 3
3 - 2
4 - 1

This is a trivial example, but what gets me is know where i am in the
destination cell so that I can return the right value from the input
range.

Does that make sense?


Function foo(Rin As Range)

' foo = Rin.Row
'foo = Rin.Rows.Count

'BUT what is the row/cell value of the cell that called me??????

End Function







  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default ForumulaArrays - help needed.

I think what i need is an example of the Minverse function ??/


Kiwi Trader Guy wrote:

Hi

I want to write a simple FormulaArray type function that will take a
Range as input, and return a value subect to where the cell is in
reference to the input range.

i.e. say a it was just to reverse the input

1 - 4
2 - 3
3 - 2
4 - 1

This is a trivial example, but what gets me is know where i am in the
destination cell so that I can return the right value from the input
range.

Does that make sense?

Function foo(Rin As Range)

' foo = Rin.Row
'foo = Rin.Rows.Count

'BUT what is the row/cell value of the cell that called me??????

End Function


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default ForumulaArrays - help needed.


set rng = application.Caller
rw = rng.row
col = rng.column

--
Regards,
Tom Ogilvy



"Kiwi Trader Guy" wrote in message
...
Hi

I want to write a simple FormulaArray type function that will take a
Range as input, and return a value subect to where the cell is in
reference to the input range.

i.e. say a it was just to reverse the input

1 - 4
2 - 3
3 - 2
4 - 1

This is a trivial example, but what gets me is know where i am in the
destination cell so that I can return the right value from the input
range.

Does that make sense?


Function foo(Rin As Range)

' foo = Rin.Row
'foo = Rin.Rows.Count

'BUT what is the row/cell value of the cell that called me??????

End Function









  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default ForumulaArrays - help needed.

Thanks for your response.

Unfortunately this only returned the first cell of the selection, and as I
was using a CSE (CNTL-SHIFT-ENTER) function, this was just the top of the
range of the column that was selected.

Perhaps I need to return a range or somehow set all the values in the range
in the function - but I don't quite understand how these CSE functions are
supposed to work.

Would be good to see the function definition of say MINVERSE as this does
it.

Thanks in advance



Tom Ogilvy wrote:

set rng = application.Caller
rw = rng.row
col = rng.column

--
Regards,
Tom Ogilvy

"Kiwi Trader Guy" wrote in message
...
Hi

I want to write a simple FormulaArray type function that will take a
Range as input, and return a value subect to where the cell is in
reference to the input range.

i.e. say a it was just to reverse the input

1 - 4
2 - 3
3 - 2
4 - 1

This is a trivial example, but what gets me is know where i am in the
destination cell so that I can return the right value from the input
range.

Does that make sense?


Function foo(Rin As Range)

' foo = Rin.Row
'foo = Rin.Rows.Count

'BUT what is the row/cell value of the cell that called me??????

End Function








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default ForumulaArrays - help needed.

apparently your confused.

Public Function Test(rng As Range)
Set rng1 = Application.Caller
Debug.Print rng1.Address
ReDim varr(1 To rng1.Rows.Count, _
1 To rng1.Columns.Count)
For i = 1 To UBound(varr, 1)
For j = 1 To UBound(varr, 2)
varr(i, j) = rng1(i, j).Address
Next
Next
Test = varr
End Function

displayed the address of each cell in that addres and in the immediate
window (the debug.print statement) it displayed

$G$4:$J$14

This definitely was more than one cell and included the entire range where
the formula was entered.


Most people won't understand CSE. that is some cutesy name dreamed up in
the Mr. Excel forum. The appropriate name is array formula. Better to
communicate in common terminology.

--
Regards,
Tom Ogilvy

"Kiwi Trader Guy" wrote in message
...
Thanks for your response.

Unfortunately this only returned the first cell of the selection, and as I
was using a CSE (CNTL-SHIFT-ENTER) function, this was just the top of the
range of the column that was selected.

Perhaps I need to return a range or somehow set all the values in the

range
in the function - but I don't quite understand how these CSE functions are
supposed to work.

Would be good to see the function definition of say MINVERSE as this does
it.

Thanks in advance



Tom Ogilvy wrote:

set rng = application.Caller
rw = rng.row
col = rng.column

--
Regards,
Tom Ogilvy

"Kiwi Trader Guy" wrote in message
...
Hi

I want to write a simple FormulaArray type function that will take a
Range as input, and return a value subect to where the cell is in
reference to the input range.

i.e. say a it was just to reverse the input

1 - 4
2 - 3
3 - 2
4 - 1

This is a trivial example, but what gets me is know where i am in the
destination cell so that I can return the right value from the input
range.

Does that make sense?


Function foo(Rin As Range)

' foo = Rin.Row
'foo = Rin.Rows.Count

'BUT what is the row/cell value of the cell that called me??????

End Function












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default ForumulaArrays - help needed.

Tom

You're a champion and a generous human being.

Problems solved.

Many thanks.


A.


Tom Ogilvy wrote:

apparently your confused.

Public Function Test(rng As Range)
Set rng1 = Application.Caller
Debug.Print rng1.Address
ReDim varr(1 To rng1.Rows.Count, _
1 To rng1.Columns.Count)
For i = 1 To UBound(varr, 1)
For j = 1 To UBound(varr, 2)
varr(i, j) = rng1(i, j).Address
Next
Next
Test = varr
End Function

displayed the address of each cell in that addres and in the immediate
window (the debug.print statement) it displayed

$G$4:$J$14

This definitely was more than one cell and included the entire range where
the formula was entered.

Most people won't understand CSE. that is some cutesy name dreamed up in
the Mr. Excel forum. The appropriate name is array formula. Better to
communicate in common terminology.

--
Regards,
Tom Ogilvy

"Kiwi Trader Guy" wrote in message
...
Thanks for your response.

Unfortunately this only returned the first cell of the selection, and as I
was using a CSE (CNTL-SHIFT-ENTER) function, this was just the top of the
range of the column that was selected.

Perhaps I need to return a range or somehow set all the values in the

range
in the function - but I don't quite understand how these CSE functions are
supposed to work.

Would be good to see the function definition of say MINVERSE as this does
it.

Thanks in advance



Tom Ogilvy wrote:

set rng = application.Caller
rw = rng.row
col = rng.column

--
Regards,
Tom Ogilvy

"Kiwi Trader Guy" wrote in message
...
Hi

I want to write a simple FormulaArray type function that will take a
Range as input, and return a value subect to where the cell is in
reference to the input range.

i.e. say a it was just to reverse the input

1 - 4
2 - 3
3 - 2
4 - 1

This is a trivial example, but what gets me is know where i am in the
destination cell so that I can return the right value from the input
range.

Does that make sense?


Function foo(Rin As Range)

' foo = Rin.Row
'foo = Rin.Rows.Count

'BUT what is the row/cell value of the cell that called me??????

End Function









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
Deleting Rows With Non-Needed Data between Needed Data Daren Excel Worksheet Functions 2 September 30th 08 06:47 PM
Needed Help.. Chaos2blue Excel Worksheet Functions 5 September 1st 06 09:06 AM
help needed zomex Excel Worksheet Functions 5 January 4th 06 12:54 PM
If Then help needed RGT New Users to Excel 2 March 18th 05 01:30 AM
Help needed ! Tom Excel Programming 8 November 15th 03 12:18 AM


All times are GMT +1. The time now is 09:02 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"