=SUM Ranges Do Not Update

  • Thread starter Thread starter Country
  • Start date Start date
C

Country

I have a Excel 2000 spread sheet, with the following macro to insert
new row.

Sub InsertRow()
'
' Macro1 Macro
' Macro recorded 4/27/2004
'

'GoTo label, MyString
ActiveSheet.Unprotect
Application.Goto Reference:="MyCell"
ActiveCell.Select
ActiveCell.EntireRow.Insert
ActiveCell.Offset(-1, 0).Select
ActiveCell.EntireRow.Copy
ActiveCell.Offset(1, 0).Select
ActiveCell.PasteSpecial xlPasteAll
Application.CutCopyMode = False
ActiveCell.Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True
Scenarios:=True

End Sub

The problem is that in the "Mycell" row I have some =SUM ranges an
when I run the macro the ranges do not update to include the ne
cells.

Exsample:
=SUM(M10:M52)
New row now 53
needs to read =SUM(M10:M53), etc.

Thank
 
in the column that has the formula =sum(M10:M53).
at cell(M10) change the formula to =sum($M$10:M10) then
copy down. that should fix your problem.
$M$10 is an absolute reference meaning it never changes.
m10 is a relitive reference to the cells around it and
changes if you copy formulas and move them. copy a formula
at m10 and paste it at m20 the reference will change to
m20. copy $m$10 and paste it at m20, it's still $m$10.
 
Thank you Frank for your reply.

But this does not solve my problem.
I understand about absolute and relitive reference.
I'll try to explain,
The =SUM(M10:M52) is in the M53 cell and the data I need to sum is i
cells from M10 to M52. When you run the macro it inserts a new ro
above row 53 or Mycell row. Now my function is in M54 and stil
refering to, =SUM(M10:M52) and it should read =SUM(M10:M53).

Thanks agai
 

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

Back
Top