+ Reply to Thread
Results 1 to 2 of 2

Quick Question about variable ranges

Hybrid View

  1. #1
    Registered User
    Join Date
    02-11-2005
    Posts
    7

    Quick Question about variable ranges

    I need to select a row that the active cell is in. Is there a quick way to do this in code?

    for example I select a1, I want to be able to select the entire row or be able to select the cell to the right a2 through cell a30

    what I have tried is this and the range is giving me problems

    Dim finder As String
    Dim one As Range
    Dim two As Range

    finder = ActiveCell.Value
    one = ActiveCell.Offset(0, 1)
    two = ActiveCell.Offset(0, 30)
    Range(one:two).Select

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Lawin,

    Here are 2 code examples. One selects the entire row while the other starts tothe right of the active cell to the end of the row.


    Select Entire Row using the Active Cell:  
      ActiveCell.EntireRow.Select
      
    Select Entire Row Starting at the Right of Active Cell:
      R = ActiveCell.Row
      C = ActiveCell.Column
      Range(Cells(R, C + 1), Cells(R, Columns.Count)).Select


    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1