Sub SelectionThing()
Dim FinalSelection As Range
Cells(1, 1).Select
For Each c In Intersect(ActiveSheet.UsedRange, Range("B:B"))
If c.Value = "Aircrew" Then
If FinalSelection Is Nothing Then
Set FinalSelection = Range(Cells(c.Row, 2), Cells(c.Row, 6))
Else
Set FinalSelection = Union(FinalSelection, Range(Cells(c.Row, 2), Cells(c.Row, 6)))
End If
End If
Next c
If Not FinalSelection Is Nothing Then FinalSelection.Select
End Sub
You are not logged in, either login or create an account to post comments
Public Sub getAircrew()
Dim nRow As Long
Dim nStart As Long, nEnd As Long
' Figure out where the "AIRCREW" data starts.
For nRow = 1 To 65536
If Range("B" & nRow).Value = "AIRCREW" Then
nStart = nRow
Exit For
End If
Next nRow
' Figure out where the "AIRCREW" data ends.
For nRow = nStart To 65536
If Range("B" & nRow).Value <> "AIRCREW" Then
nEnd = nRow
Exit For
End If
Next nRow
nEnd = nEnd - 1
Range("A" & nStart & ":D" & nEnd).Select
End Sub
>
posted by Doofus Magoo at 12:01 PM on January 29