ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting Application.Sum to act like =SUM (https://www.excelbanter.com/excel-programming/272255-getting-application-sum-act-like-%3Dsum.html)

Mike Cooper

Getting Application.Sum to act like =SUM
 
Hi there,

I am attempting to create a VBA subroutine which will perform the work
of
=SUM(Range)

The following:

MySum = Application.Sum(Cells(Master_New_Entry_Row, 2), _
Cells(Master_New_Entry_Row, 6))

....works just fine except for one flaw. With the =SUM excel function,
non-numeric columns get ignored and the function still sums the
numeric columns within the given range. Using "Application.Sum" they
don't. If there is a non-numeric column in the above range, the
function errors out!

Is there anyone who can tell me a way to make Application.Sum act like
=SUM without having to verify each and every column as numeric first?

Thank you,
Mike Cooper


All times are GMT +1. The time now is 02:51 AM.

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