VB function that accepts an array of unknown length

Posted on 2014-03-28
Last Modified: 2014-03-28
Would like a sample function that takes as its argument any array (one or two dimensions) and then gets its length (or if its two dimensional its length in both directions).  Then allows me to do some sort of calculation on it and return that value (e.g. average, sum, max min).
Question by:dma70
  • 3
  • 2
LVL 32

Accepted Solution

Stefan Hoffmann earned 400 total points
ID: 39961720

Author Closing Comment

ID: 39961735
Thank you that is very useful.   What did you use to find this?

Author Comment

ID: 39961847
ste5an:   I just tried one of the functions listed.  Do you know why the following gives me an error?:

LVL 32

Expert Comment

by:Stefan Hoffmann
ID: 39962084

Author Comment

ID: 39962112
thanks -- I was able to get the function to compile when I added the huge number of functions your textbook referred to.   But the program still fails on the Array Allocation test.

Despite what you sent me - I think this is beyond my comprehension.    All I care about is that the function accepts any set of cell range as an input.   It doesn't at the moment until I understand more about what allocation means.    I am not sure why this needs to be so complicated.

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now