simora
08-04-2015, 03:06 PM
I have a sheet called "Totals" which sums all the worksheet totals for each cell between the sheets called "FIRST" and "LAST"
The formula that goes into each cell is like
=SUM(First:Last!D3)
Now what I want is to put the formula into each cell in a range so that it totals all the appropriate cells.
How can I re-write it in VBA so that if a cell's calculated value is 0 or nothing it just gives me a blank " " else it calculates the cell's value.
This works like this
Range("D3:E666").Formula = "=Sum(First:Last!D3)"
But when I try to do this to account for the cell's calculated value being zero
Range("D3:E666").Formula = "=IF(SUM(First:Last!D3)=0,"",=SUM(First:Last!D3))"
I get an error.
The formula that goes into each cell is like
=SUM(First:Last!D3)
Now what I want is to put the formula into each cell in a range so that it totals all the appropriate cells.
How can I re-write it in VBA so that if a cell's calculated value is 0 or nothing it just gives me a blank " " else it calculates the cell's value.
This works like this
Range("D3:E666").Formula = "=Sum(First:Last!D3)"
But when I try to do this to account for the cell's calculated value being zero
Range("D3:E666").Formula = "=IF(SUM(First:Last!D3)=0,"",=SUM(First:Last!D3))"
I get an error.