Hello Everyone,
A while ago, I created a button in a spreadsheet so that if the user needed to add additional lines, they could just click the button and a VBA code would insert a new row and transfer the formulas to new row.
Here is the code:
That has been working perfectly for a couple years, but recently I had to add a column (Col J) in file below that tabulates a running daily total.
This is the formula in those cells:
Bait Sheet.jpg
A simple formula that works fine, except when a line is inserted. When you insert a line with the VBA button some of the cell references in the cell immediately below are updated and some are not.
Here is an example:
- Original Formula in cell J795: =IF(A795=A794,J794+F795,F795)
- Line inserted just above pushes cell J795 down and makes it cell J796
- Formula after line inserted: =IF(A796=A794,J794+F796,F796)
As you can see, the 795 references were updated to 796, but the 794 references stayed the same, which messes up the calculations. This only occurs in the line immediately following the inserted line. The remainder of the cells below are updated correctly.
Is there anyway to rectify this?
Thank you for your time.
Bookmarks