Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Deleting rows without losing formulas

If I have a column of cells, say A1 to A15 with the values of A1=1,
A2=A1+1,A3=A2+1 etc, then if I want to delete say row A6, row A7 will show
the #REF! error. Is there a way to delete the row without losing the
formula in the next row?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Deleting rows without losing formulas

John,
Instead of a2=A1+1, A3=A2+1 etc
try a2=offset(a2,-1,0)+1, a3=offset(a3,-1,0)+1 etc
regards,
Lionel


"John Davies" wrote:

If I have a column of cells, say A1 to A15 with the values of A1=1,
A2=A1+1,A3=A2+1 etc, then if I want to delete say row A6, row A7 will show
the #REF! error. Is there a way to delete the row without losing the
formula in the next row?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Deleting rows without losing formulas

Hi Lionel

That works fine, but if I want to insert a line, the formula recalculates
from the inserted point. Is there a way to delete and insert lines without
losing the format.

Also to be a pain, say that a column of cells has formulae that refer to a
lookup table e.g. a2=vlookup(e12,data,5), a3=vlookup(e13,data,5) etc is there
a way to delete and insert rows without losing the formulas in the next row.

Thanks for your help


"John Davies" wrote:

If I have a column of cells, say A1 to A15 with the values of A1=1,
A2=A1+1,A3=A2+1 etc, then if I want to delete say row A6, row A7 will show
the #REF! error. Is there a way to delete the row without losing the
formula in the next row?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default Deleting rows without losing formulas

Hi John,
See Insert a Row using a Macro to maintain formulas
http://www.mvps.org/dmcritchie/excel/insrtrow.htm

A VERY important aspect of this is changing your formula to use
OFFSET so that you can insert, delete, sort 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

"John Davies" wrote in message ...
Hi Lionel

That works fine, but if I want to insert a line, the formula recalculates
from the inserted point. Is there a way to delete and insert lines without
losing the format.

Also to be a pain, say that a column of cells has formulae that refer to a
lookup table e.g. a2=vlookup(e12,data,5), a3=vlookup(e13,data,5) etc is there
a way to delete and insert rows without losing the formulas in the next row.

Thanks for your help


"John Davies" wrote:

If I have a column of cells, say A1 to A15 with the values of A1=1,
A2=A1+1,A3=A2+1 etc, then if I want to delete say row A6, row A7 will show
the #REF! error. Is there a way to delete the row without losing the
formula in the next row?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Deleting rows without losing formulas

Another option, with some warnings, might be a named formula.

ActiveWorkbook.Names.Add "Add1", "=R[-1]C+1"

Now, in A2, enter the formula : =Add1
and copy down.
Just don't copy the sheet, as this will cause errors.

--
Dana DeLouis
Win XP & Office 2003


"John Davies" wrote in message
...
If I have a column of cells, say A1 to A15 with the values of A1=1,
A2=A1+1,A3=A2+1 etc, then if I want to delete say row A6, row A7 will show
the #REF! error. Is there a way to delete the row without losing the
formula in the next row?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protect Formulas while deleting rows RLD Excel Discussion (Misc queries) 1 March 15th 10 06:10 AM
Way to keep formulas unchanged when deleting rows? PeteJ Excel Discussion (Misc queries) 8 November 18th 09 04:19 PM
deleting rows messing up formulas Chad Excel Discussion (Misc queries) 2 January 30th 09 06:19 AM
Adding and deleting rows with formulas ****Need Help**** [email protected] Excel Discussion (Misc queries) 5 May 31st 06 05:42 PM
deleting rows--calculating formulas with each row as it goes? Lonnie Excel Discussion (Misc queries) 1 December 14th 04 08:15 PM


All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"