View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Determining the size of an input array

I'm not sure what you're doing, but you could loop through each cell in the
range that was passed, too:

Option Explicit
Function mySum(rng as range) as double
dim myCell as range
dim myTotal as double

mytotal = 0

for each mycell in rng.cells
if isnumeric(mycell.value) then
mytotal = mytotal + mycell.value
end if
next mycell

mySum = myTotal

end function

(with not much error checking)



Tom Kreutz wrote:

Dear Folks,

In Visual Basic, how does one determine the size of an array (range?)
being passed in from Excel? For example, if I wanted to write my own
version of SUM(), how would I know the size/length of the range that the
user has chosen?

Many thanks,

Tom Kreutz


--

Dave Peterson