Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Changing Range & Cell refs.

Is there any way to make a macro automatically "follow" changes to the
worksheet itself?

For example, I might have a macro with an instruction such as

Range("C5") = x

But then I need to modify the sheet and insert columns and/or rows that
requires the value 'x' to now appear in G9 but I have to manually change the
macro instructions.

I'm sure that there must be a way to avoid this hassle but how?

TIA
Stella


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Changing Range & Cell refs.

Use a Named Range:

Let's say that in the worksheet we created the name benine for =Sheet1!$B$9
the macro:

Sub ordinate()
MsgBox (Range("benine").Value)
MsgBox (Range("benine").Address)
End Sub

will display the contents and address of B9. If you insert rows before B9,
the name in the worksheet will automatically adjust and the macro will track
to the new cell.
--
Gary''s Student


"Stella" wrote:

Is there any way to make a macro automatically "follow" changes to the
worksheet itself?

For example, I might have a macro with an instruction such as

Range("C5") = x

But then I need to modify the sheet and insert columns and/or rows that
requires the value 'x' to now appear in G9 but I have to manually change the
macro instructions.

I'm sure that there must be a way to avoid this hassle but how?

TIA
Stella



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
auto-hide rows, cell format (# and @), update cell refs, shade cel Mo2 Excel Discussion (Misc queries) 0 April 17th 07 03:44 AM
returning absolute cell refs karl41 Excel Discussion (Misc queries) 3 August 22nd 06 11:59 AM
Vlookup refs a cell that has a worksheet name Peter Excel Worksheet Functions 7 February 6th 06 06:41 PM
How do I fix cell refs when adding rows Dave L Excel Discussion (Misc queries) 5 December 2nd 05 09:52 PM
Variable Cell Refs Craig[_15_] Excel Programming 2 April 28th 04 04:04 PM


All times are GMT +1. The time now is 04:09 AM.

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

About Us

"It's about Microsoft Excel"