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: 1
Default Find size of array passed to user-defined function

I'd like to write a function which accepts a list and
executes a for loop with operations on each element in
the list. I can't figure out how to get the size of the
list. For example, my call in an excel cell would be

=myfun(A1:A10)

and the VBA code is

Public Function myfun(data)
Dim idx As Integer

size = ???
For idx = 1 To size
... data(idx) ...
Next idx

How do I get the size of data (10 in this example)? It
would be nice if it worked for both horizontal and
vertical arrays, but I'll take either.

Thanks!



 
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
user defined function driller Excel Worksheet Functions 1 November 18th 06 04:51 PM
How do I set the User Defined paper size in Excel? Tony Excel Discussion (Misc queries) 1 March 9th 05 10:06 PM
User defined charts- font size too small Bill B Charts and Charting in Excel 1 December 30th 04 06:23 PM
How do I convert a user defined selection into an array? TBA[_2_] Excel Programming 3 August 18th 03 12:51 AM
Passing an Array of User-Defined Type to an Argument of a Function Tushar Mehta[_6_] Excel Programming 0 August 17th 03 06:43 PM


All times are GMT +1. The time now is 11:31 AM.

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"