ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   automatically insert rows (https://www.excelbanter.com/excel-programming/429871-automatically-insert-rows.html)

Slub

automatically insert rows
 
I am working on a spreadsheet for a non-profit group, it keeps a running
total of items purchased. I am having trouble making a macro that will auto
insert rows above the total line. It looks something like this:

Recept# Name Item Code Check# Check$ Cash Total



Total

The donations can change every month and they have to remove any blank rows
befor turning in. So it seems to me the best way would be to auto insert
lines as needed. Any Ideas?

Thank you.

Thank you!

Patrick Molloy

automatically insert rows
 
assumimg totals in column G

Rows(Range("G1").End(xlDown).Row).Insert

BUT are your totals formulae? eg =SUM(R[-1]C:R2C)
if so then inserting a row will not quite work... your formula will just
point at a row higher
ie =SUM(R[-2]C:R2C)

I'd suggest locking the formula to a blank row immediately above the totals

so if your data is rows 8 to 50
have your totals in row 52 and your formula like =SUM(G2:G51)
now, inserting at row 51 leave the formula valid, =SUM(G2:G52)

and use

Rows(Range("G1").End(xlDown).Row)-1.Insert




"Slub" wrote in message
...
I am working on a spreadsheet for a non-profit group, it keeps a running
total of items purchased. I am having trouble making a macro that will
auto
insert rows above the total line. It looks something like this:

Recept# Name Item Code Check# Check$ Cash Total



Total

The donations can change every month and they have to remove any blank
rows
befor turning in. So it seems to me the best way would be to auto insert
lines as needed. Any Ideas?

Thank you.

Thank you!



KC

automatically insert rows
 
Would you consider putting Total ahead of the list?

"Slub" wrote in message
...
I am working on a spreadsheet for a non-profit group, it keeps a running
total of items purchased. I am having trouble making a macro that will
auto
insert rows above the total line. It looks something like this:

Recept# Name Item Code Check# Check$ Cash Total



Total

The donations can change every month and they have to remove any blank
rows
befor turning in. So it seems to me the best way would be to auto insert
lines as needed. Any Ideas?

Thank you.

Thank you!




All times are GMT +1. The time now is 08:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com