Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Arvi
For data in vectors, something along these lines: Function Test(Var As Variant) As Variant 'Leo Heuser, 19-4-2005 Dim Counter As Long Dim Dummy As Long Dim ResultValue As Variant Dim Sm As Double Dim Trans As Boolean If TypeName(Var) = "Range" Then ResultValue = Var.Value If UBound(ResultValue, 2) 1 Then Trans = True Else ResultValue = Var On Error Resume Next Dummy = UBound(ResultValue, 2) If Err.Number 0 Then Trans = True On Error GoTo 0 End If If Trans Then ResultValue = _ Application.Transpose(ResultValue) For Counter = 1 To UBound(ResultValue) Sm = Sm + ResultValue(Counter, 1) Next Counter Test = Sm End Function -- Best Regards Leo Heuser Followup to newsgroup only please. "Arvi Laanemets" skrev i en meddelelse ... Hi How to create an UDF which can have as parameter either the cell range or an array, i.e both syntaxes in examples below will work: =MyFunction(A2,B2,OtherSheet!$A$2:$A$7) or =MyFunction(A2,B2,{2;3;4;5;6;7}) Thanks in advance -- When sending mail, use address arvil<attarkon.ee Arvi Laanemets |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel2000:How to link Print Area with a named range | Excel Worksheet Functions | |||
Defining new function with cell range parameter | Excel Programming | |||
Printing date range in excel2000 | Excel Programming | |||
Excel2000: Reading Named Range value from VBA | Excel Programming | |||
Excel2000: finding last row of used range | Excel Programming |