LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 905
Default How to work with reference unions (A1,A3,A5)?

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
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
unions, intersections or array constants Loadmaster Excel Worksheet Functions 24 May 6th 09 08:11 PM
formula to work in a 3-d reference with 2 work books capt c Excel Worksheet Functions 1 April 8th 09 08:04 PM
Help.. Drag reference to the right does not work... [email protected] New Users to Excel 11 December 5th 06 10:25 AM
Advanced Filters with Unions John Excel Programming 1 April 27th 06 01:34 PM
Sorting Unions Alex[_9_] Excel Programming 1 September 4th 03 07:40 PM


All times are GMT +1. The time now is 04:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"