Thanks joel for your patience here
The first code is called AGK (in C4) and despite there being 9 data rows for
it the first inserted Total line for AGK is in row 12 (not 13) and the
formulas in that line are as follows
N12=SUM(F4:F11)
O12=SUM(K4:K11)
P12=O12/N12
The only problem with the whole thing is that the original last data row for
AGK ( ie in row 12) gets moved down one row and treated as a new unique
Product Code with its own Total row inserted after it.
I stepped it through and watched it insert this last line then every Code
after that was fine and in the right place
"joel" wrote:
I'm thinking it something with the data and not the code since I ddi a
good job of checking the code and have used this code lots of time in
the past.
Can you post the formulas that you have in cells N13, O13, P13. The
formulas should read
=Sum(F4:F12)
=Sum(K4:K12)
=O13/O12
You first posting said you data starts in row 4. Your second posting
said you had 9 occurances of AGK (rows 4 to 12). the code would then
add an empty row at row 13 and insert the formulas in the new row.
The first row that starts counting is row for and the first row that
get put into the formulas is the variable StartRow as shown in these two
lines
RowCount = 4
StartRow = RowCount
--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=177957
Microsoft Office Help
.