![]() |
How can I build a Excel Function that acts like those built-in
I give column "A:A" a name as "Time",
so when I select column B and input an array formula as "=sin(Time)",for different "Time" values I can get according "Sin(time)" values. I want to build a function MyFunc which is more complex than "Sin" ,below is the code: function MyFunc(t as variant) as double select case typename(t) case "Range" MyFunc=MoreComplexFunc(t.Value) '#Q1:How to get the proper Array item? case else MyFunc=MoreComplexFunc(Val(t)) end select end function what is the difficulty is that if I input formula "=MyFunc(Time)" in different cells,the return values are the same. Can somebody tell me how to pass/get the proper array item value? |
How can I build a Excel Function that acts like those built-in
Wlh wrote:
Can somebody tell me how to pass/get the proper array item value? case "Range" If T.Cells.Count1 Then MyFunc =MoreComplexFunc(T.Cells(Application.Caller.Row - T.Row + 1, 1)) Else MyFunc=MoreComplexFunc(t.Value) End If Bill Manville MVP - Microsoft Excel, Oxford, England No email replies please - reply in newsgroup |
All times are GMT +1. The time now is 01:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com