Forum Discussion
gray_b365
Mar 20, 2025Copper Contributor
Why does SUM not work for me ??
My worksheet has been generated by VBA from another master worksheet. By filtering data, and copy/paste.
I am using office 365, and a simple =SUM(A2:A4) of 3 numbers (5,10,5) on that page does not work.
It just displays 0.00
All the cells are formatted as a number.
Any ideas please
- Riny_van_EekelenPlatinum Contributor
That I don't know as I don't do anything with VBA. Sorry!
In addition, applying number format to texts which looks like numbers changes nothing. You may check what actually you have with ISNUMBER() or ISTEXT()
- Riny_van_EekelenPlatinum Contributor
I suspect your macro pasted texts in stead of numbers. Then SUM will indeed will return zero.
- gray_b365Copper Contributor
I think the pasting was the problem.
But that leads me onto. How do I format the data in the paste operation or cell formatting to be a 'number' when pasted in VBA ?
Could you attach a small sample workbook demonstrating the problem (without sensitive data), or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar?