![]() |
Looping and inserting negaive totals
How would I code a macro to have it -sum()
Afterwards Col E should total 0.00 In Cell E426 -754.05 E422 -5,409.85 << I have several groups like this between Row 6 and 427 E420 -13,397.65 E418 -4,132.69 E6 -60.00 I've been trying to alter similar code, but without success. Thanks in Advance.. Row# Col E 6 7 60.00 ..... 418 419 4132.69 420 421 13397.65 422 423 2365.13 424 1522.36 425 1522.36 426 427 754.05 |
Looping and inserting negaive totals
Sub MakeNegatives()
Dim lastrow as Long, i as Long Dim sm as double lastrow = cells(rows.count,"E").End(xlup).Row for i = lastrow to 6 step - 1 if not isempty(cells(i,"E")) then sm = sm + cells(i,"E") else cells(i,"E").Value = -1 * sm sm = 0 end if Next End Sub Untested, but this should get you started. -- Regards, Tom Ogilvy "Jim May" wrote: How would I code a macro to have it -sum() Afterwards Col E should total 0.00 In Cell E426 -754.05 E422 -5,409.85 << I have several groups like this between Row 6 and 427 E420 -13,397.65 E418 -4,132.69 E6 -60.00 I've been trying to alter similar code, but without success. Thanks in Advance.. Row# Col E 6 7 60.00 ..... 418 419 4132.69 420 421 13397.65 422 423 2365.13 424 1522.36 425 1522.36 426 427 754.05 |
All times are GMT +1. The time now is 03:11 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com