Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Aug 2001
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Additive Selection (2000)

    I want to select all rows in the sheet based on the formula of one cell. Here's my code:

    N = 1

    Do While Range("A1").Offset(N, 0).Formula <> ""
    If Range("A1").Offset(N, 0).Formula <> "SNRT" Then
    Range("A1").Offset(N, 0).EntireRow.Select
    End If
    N = N + 1
    Loop

    This selects only one at a time. I want to do a group selection, equivalent to holding down CTRL and selecting rows here and there. How do I do this? In the help it said I should the Replace argument to the Select method but Range("A1").Offset(N, 0).EntireRow.Select(False) is a syntax error. Help!

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Additive Selection (2000)

    Not sure if I follow exactly, but you can build a range with Union as follows :<pre> Dim oSelect As Range
    Do While Range("A1").Offset(N, 0).Formula <> ""
    If Range("A1").Offset(N, 0).Formula <> "SNRT" Then
    If Not oSelect Is Nothing Then
    Set oSelect = Union(oSelect, Range("A1").Offset(N, 0).EntireRow)
    Else
    Set oSelect = Range("A1").Offset(N, 0).EntireRow
    End If
    End If
    N = N + 1
    Loop
    oSelect.Select</pre>

    Andrew C

  3. #3
    Star Lounger
    Join Date
    Aug 2001
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Additive Selection (2000)

    Andrew, that worked perfectly. Thank you!

Posting Permissions

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