View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Translate range name passed as string to a custom function to range addresses!

Function myFunc(rangeName as string)
dim dblSum as Double
set rng = Range(rangeName)
for each cell in rng
if isnumeric(cell) then
dblSum = dblSum + cdbl(cell.value)
end sub
Next
myFunc = dblSum
End Sub

--
regards,
Tom Ogilvy


"agarwaldvk " wrote in message
...
Hi All

I am trying to write a custom function where I am passing a range name
as a string. This range name can comprise of 1 or more range areas
delimited by commas (,). These range areas may or may not be contiguous
areas.

For example, if my custom function is called "myFunc()" this is how it
will look like (shown below) :-

Function myFunc(rangeName as string)