Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jul 2006
    Posts
    71
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Extend Named Range (2003)

    I have a spreadsheet with a number of named ranges, some dynamic. One begins at $I$15 and ends at $O (row varies). I would like a way to tell a macro to select this range, "Hourly" and then extend the selection from the top left at $I$15 to a top left of $B$15. Then copy the selection to the clipboard.

    On a NEW master copy of this spreadsheet, it's just a matter of selecting the desired range as $B$15:$O (whatever) and giving it a new name, which I've done. But I also have several hundred copies of earlier versions being shared and processed every week, and creating a new named range on each of them -- if possible -- would consume more time than we have.

    Many thanks,

    axsc

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Extend Named Range (2003)

    You could use
    <code>
    Range("Hourly").Offset(RowOffset:=0, ColumnOffset:=-7).Resize(ColumnSize:=14).Copy
    </code>
    This moves the top left cell 7 columns to the left (from column I to column , then extends the width to 14 columns (B to O), and finally copies this range to the clipboard.

  3. #3
    Star Lounger
    Join Date
    Jul 2006
    Posts
    71
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Extend Named Range (2003)

    Wow, how elegant!

    I wasn't expecting to achieve everything in a single line.

    I've modified it to select Visible Cells and that seems to be working:

    Range("Hourly").Offset(RowOffset:=0, ColumnOffset:=-7).Resize(ColumnSize:=14).SpecialCells(xlCellTypeV isible).Copy


    Many thanks,

    axsc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •