Dynamic Range.Select
MZ Tools makes life easier for the Excel VBA coder
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Dynamic Range.Select

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I need a technique to .Select a range of cells that are based on stored column and row values.

    Range("A1:Z10).Select is a "hard coded method and does not fit my needs.

    I first position to the first cell and save the cell values using:
    StartRow = ActiveCell.Row
    StartCol = ActiveCell.Column

    then, locate end cell and similarly save:
    EndRow = ActiveCell.Row
    EndCol = ActiveCell.Column

    The results of save are:
    StarRow = 1
    StartCol = 1
    EndRow = 10
    EndCol = 26

    These values define the points of my cell range.

    How do I .Select this range? The following is close, but incomplete....

    Range(Columns(SCol),Columns(ECol)).Select
    *********************************************
    EMSS

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sydney, Australia
    Posts
    2,936
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Hi,

    How about:-

    Range(Cells(startrow, startcol), Cells(endrow, endcol)).Select


    Hope it helps,
    D

  3. #3
    MrExcel MVP Russell Hauf's Avatar
    Join Date
    Feb 2002
    Location
    Portland, OR Area - USA
    Posts
    1,605
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-27 11:00, Ed S. wrote:
    I need a technique to .Select a range of cells that are based on stored column and row values.

    Range("A1:Z10).Select is a "hard coded method and does not fit my needs.

    I first position to the first cell and save the cell values using:
    StartRow = ActiveCell.Row
    StartCol = ActiveCell.Column

    then, locate end cell and similarly save:
    EndRow = ActiveCell.Row
    EndCol = ActiveCell.Column

    The results of save are:
    StarRow = 1
    StartCol = 1
    EndRow = 10
    EndCol = 26

    These values define the points of my cell range.

    How do I .Select this range? The following is close, but incomplete....

    Range(Columns(SCol),Columns(ECol)).Select
    *********************************************
    Range(Cells(StartRow, StartCol),Cells(EndRow, EndCol)).Select

    Hope this helps,

    Russell

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com