automatically insert rows

S

Slub

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!
 
P

Patrick Molloy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top