Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I tried to use the SUM function in VBA. I had used similar code successfully before, but now get a zero result, even if there are non-zero numbers in the range. Here's the code. Of course, nRow, nCol and NumColsOutput have been previously defined.
Set zRange = .Range(.Cells(nRow, nCol), .Cells(nRow, NumColsOutput)) Sum = WorksheetFunction.Sum(zRange) If I use "zRange.Select", I can see that it is selecting the desired range of cells, so the Range works correctly, yet the SUM is wrong. I then tried the simple worksheet function, entered into a cell: =SUM(A1:D3) I found that sometimes I got a zero result, sometimes a non-zero result. Can anyone suggest why I might be getting these "false" zero results from the SUM function? Thank you very much for any help you may be able to offer. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Month function yields incorrect solution | Excel Worksheet Functions | |||
Production Yields | New Users to Excel | |||
Substitute function yields #VALUE! when add the instance_number | Excel Worksheet Functions | |||
Need help with bond yields | Excel Discussion (Misc queries) | |||
ACCRINT formula yields incorrect result | Excel Worksheet Functions |