View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ardus Petus Ardus Petus is offline
external usenet poster
 
Posts: 718
Default How do I make references to cells in subroutines relative?

Use named range instead of literal

Cheers
--
AP

"Atreides" <atreides1AThotmailD0Tcom a écrit dans le message de news:
...
How do I make references to cells in subroutines relative?

For example, if part of my subroutine is:

Range("A5:D33").Select

then I insert or delete cells in the spreadsheet, the references to these
cells in the macro stay the same, and are thus incorrect. They always have
to
be updated manually. How can I make these change automatically when I
modify
the spreadsheet?

Or is there a better way to reference cells in the worksheet?

Thanks
Atreides