Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Updating Ranges or References in Code when Adding or Deleting Rows

Greetings Programmers,

Would there happen be a way to update all ranges or references in
modules when one or more rows are added or deleted?

Reason I ask is that the 'heading' row on a sheet starts on row 12,
and users may wish to add or remove rows above this heading line.
Examples of code with set ranges a

Set ActivityDate = ActiveSheet.Range("C11")
and
ActiveSheet.Cells(lastcolumn + 1).Offset(12, 0).Select

....so references such as C11 and (12,0) would be affected.

Just curious.
Thanks,
Arnold

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Updating Ranges or References in Code when Adding or Deleting Rows

One way to do that would be to create named ranges (insert=Name=define) and
refer to those in your code rather than absolute cell addresses. The formula
specifying the location of the named range will adjust like any other formula
in excel and the name will continue to point to the same cell, even though it
has moved.

Another way is to calculate the location from some base location or use the
find method to find a reference value and offset from there.

--
Regards,
Tom Ogilvy


"Arnold" wrote:

Greetings Programmers,

Would there happen be a way to update all ranges or references in
modules when one or more rows are added or deleted?

Reason I ask is that the 'heading' row on a sheet starts on row 12,
and users may wish to add or remove rows above this heading line.
Examples of code with set ranges a

Set ActivityDate = ActiveSheet.Range("C11")
and
ActiveSheet.Cells(lastcolumn + 1).Offset(12, 0).Select

....so references such as C11 and (12,0) would be affected.

Just curious.
Thanks,
Arnold


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
Adding and deleting rows with formulas ****Need Help**** [email protected] Excel Discussion (Misc queries) 5 May 31st 06 05:42 PM
Updating, Deleting and inserting rows over two Excel Sheets Dilip Mistry Excel Worksheet Functions 0 July 25th 05 07:09 PM
Keeping a series table from updating when adding new rows. Jacen Saracen Charts and Charting in Excel 2 July 18th 05 04:54 AM
deleting mutliple rows in different ranges at same time HeatherO Excel Programming 4 February 14th 05 02:01 PM
Updating (Adding Rows) To A Second Worksheet jdcollins21[_4_] Excel Programming 1 November 24th 03 06:31 PM


All times are GMT +1. The time now is 10:47 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"