View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Best Practice - Cell and Range references in VBA?

That's a pretty big question.

One technique is to name the range you need to use
(in xl2003 menus: Insert|Name)

Then if you insert or delete any rows/columns, then that name will refer to that
original cell--unless you delete the row/column that contained the cell.



DocBrown wrote:

I have seen many methods to reference ranges and cells in VBA. Also, in a WS
various techniques are used to allow for insertion and deletions of cells and
columns, such as relative and absolute addressing.

When rows and columns are changed in a WS, As far as I can tell, those
adjustments are not made in the Macros.

My question is: What is the best practice for coding functions and macros so
that they don't break if the rows and columns are changed in the worksheet we
are referencing?

Thanks,
John


--

Dave Peterson