ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create Function like Sum() (https://www.excelbanter.com/excel-programming/350313-create-function-like-sum.html)

Yap Michael

Create Function like Sum()
 
Dear All,

Has anyone ever create function like sum() which have parameter in
range? What's parameter type should be used?

Thanks for the help

Tom Ogilvy

Create Function like Sum()
 
Public Function MySum(rng as Range) as Double
Dim tot as Double
Dim cell as Range
for each cell in rng
if isnumeric(cell) then
tot = tot + cell.Value
end if
MySum = Tot
End Function

Would be a simple implementation. The correct answer depends on exactly
what you want the function to be able to do.



--
Regards,
Tom Ogilvy



"Yap Michael" wrote in message
...
Dear All,

Has anyone ever create function like sum() which have parameter in
range? What's parameter type should be used?

Thanks for the help





All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com