Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What kind of object is passed to a VB function when called from Excel with
reference union like (A1,A3,A5)? How can I determine the size of the union (number of references)? Consider the following paradigm: Function myIRR(myVal As Range, _ Optional myGuess As Double = 0.1, _ Optional n As Long = 0) Dim dVal() As Double If n <= 0 Then n = myVal.Rows.Count ReDim dVal(1 To n) n = 0 For Each cell In myVal: n = n + 1: dVal(n) = cell: Next myIRR = IRR(dVal, myGuess) End Function That works with (A1,A3,A5), but I must pass n=3. myVal.Rows.Count is 1 unless myVal is a contiguous range like A1:A5. PS: I know that I can use WorksheetFunction.IRR instead for this example. I am using IRR just for demonstration purposes. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
unions, intersections or array constants | Excel Worksheet Functions | |||
formula to work in a 3-d reference with 2 work books | Excel Worksheet Functions | |||
Help.. Drag reference to the right does not work... | New Users to Excel | |||
Advanced Filters with Unions | Excel Programming | |||
Sorting Unions | Excel Programming |