View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
david mcritchie david mcritchie is offline
external usenet poster
 
Posts: 691
Default How do I insert a row and keep all the formulas in the cells?

See my page
Insert Row and Maintain Formulas
http://www.mvps.org/dmcritchie/excel/insrtrow.htm


A11: =SUM($A2:OFFSET(A11,-1,0))
then you don't have to rewrite the SUM when you insert a row immediate
before your total row.

But as you know the formulas you are using will not work. Take a look at
the use of OFFSET on the above page. You will have to rewrite your
formulas, and copy down with the fill handle. Then you are ready for future
insertion/deletion of rows.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Thomas Cusick" wrote in message ...
I didn't know I had too Enable Automatic Calculation.

As far as me figuring out the first part I did not. :(

What I thought I would do was make the macro to insert the row and then to
copy the cell to the next cell and so on... the problem with this is that
the macro takes you literally when you click or move to a specific cell.
What I need it to do is to insert the new row above the last TOTALS line and
then copy the formulas into that row. But every time I try this I end up
getting specific cells (like the following example:
Selection.EntireRow.Insert
Selection.End(xlUp).Select
Selection.End(xlToRight).Select
Selection.Copy
Range("G10").Select <-- Basically i need this to float where the row
is inserted
ActiveSheet.Paste
Range("A10").Select

Now if i run this macro it will insert a new row at the end of the table
before the TOTALS line, but it copies the formula in the G column in G10
instead of where the new line is inserted.

Does this make any sense??
-----------------------------------------------------------------------
"Frank Kabel" wrote:

Hi
have you enabled automatic calculation?

--
Regards
Frank Kabel
Frankfurt, Germany

"Thomas Cusick" schrieb im
Newsbeitrag ...
I am making a commission excel sheet and I want to make a macro to

insert
cells for the sales people to press so they don't have to select

Insert and
Rows from the menus. The macro inserts the row just fine but two

things are
happening.
1. The cells on the line are all blank, they are not copying the

formulas
from the cell on or above. (actually while typing this i think i

have
figured this one out)
but more importantly...
2. The SUM fields are not updating after running my insert macro...

Suggestions...

Tom Cusick
Tech Support
Servant PC Resources, Inc.