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

    Picking up information in row (excel 2003)

    Hello,

    I have a spreadsheet with 6 columns and 2045 rows of data. I need to pull out anything that has the "eac" text as port of the data in a cell and delete the rows that do not. Is there a way to get this information and delete the rows that do not have this information via a macro or a formula? Any help would be great.

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

    Re: Picking up information in row (excel 2003)

    I assumed that

    1) The columns are A through F.
    2) Row 1 is a header row that should be preserved.

    The following macro will remove rows that do not contain "eac":
    <code>
    Sub KeepEac()
    Dim m As Long
    Dim r As Long
    Dim rng As Range

    m = Cells.Find(What:="*", SearchDirection:=xlPrevious, _
    SearchOrder:=xlByRows).Row
    For r = m To 2 Step -1
    Set rng = Range("A" & r & ":F" & r).Find(What:="eac", _
    LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False)
    If rng Is Nothing Then
    Range("A" & r).EntireRow.Delete
    End If
    Next r
    End Sub
    </code>
    You can change "A" and "F" as needed, and adjust the limit 2 of the loop.

  3. #3
    3 Star Lounger
    Join Date
    Dec 2006
    Posts
    250
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Picking up information in row (excel 2003)

    Thanks Hans.

Posting Permissions

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