+ Reply to Thread
Results 1 to 3 of 3

Extract rows with specific text in a column

  1. #1
    TroyB
    Guest

    Extract rows with specific text in a column

    Hi,

    I've got a large spreadsheet that I'd like to extract all the rows with the
    words "PROVISIONAL QUANTITY" or "PROVISIONAL SUM" within the text in a
    particular column.
    ie - Some cells in Column C have the words "PROVISIONAL QUANTITY" or
    "PROVISIONAL SUM" in the text somewhere. I need the data from the entire
    row if col C has these words in the cell text.

    I suspect this could be done by either 1) deleting all rows that dont
    contain these words, or 2) selecting all the rows with the words and copying
    into a blank worksheet.
    Is there an easy way to achieve this or is a macro required. If macro
    required, any help on the below macro would be great.

    Sub ProvSumCopy()
    Dim rng As Range
    Dim cell As Range
    Dim start_str As Integer

    Set rng = Selection
    For Each cell In rng
    start_str = InStr(cell.Value, "PROVISIONAL SUM")
    If start_str Then
    ActiveRow.Select
    End If
    start_str = InStr(cell.Value, "PROVISIONAL QUANTITY")
    If start_str Then
    ActiveRow.Select
    End If

    Next

    End Sub

    Thanks
    Troy










  2. #2
    Forum Contributor Kieran's Avatar
    Join Date
    10-02-2003
    Location
    Perth, Western Australia
    MS-Off Ver
    Office 2003
    Posts
    109
    Troy,

    No macro is needed.

    Selct your data range then
    Go to menu Data, fliter, autofilter
    In the top row of your data range you will see some 'little arrows'
    select the 'little arrow' at the top of the column you are interested in and using a filter you can select the required values to filter by.
    As you have 2 criteria, use the 'OR' option and repeat the process for the second filter value.
    Kieran

  3. #3
    TroyB
    Guest

    Re: Extract rows with specific text in a column

    I've actually found the answer to my own question. For all those
    interested, follow the below hyperlink relating to Advanced Filters.
    http://www.contextures.com/xladvfilter01.html

    Regards
    Troy

    "TroyB" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I've got a large spreadsheet that I'd like to extract all the rows with
    > the words "PROVISIONAL QUANTITY" or "PROVISIONAL SUM" within the text in a
    > particular column.
    > ie - Some cells in Column C have the words "PROVISIONAL QUANTITY" or
    > "PROVISIONAL SUM" in the text somewhere. I need the data from the entire
    > row if col C has these words in the cell text.
    >
    > I suspect this could be done by either 1) deleting all rows that dont
    > contain these words, or 2) selecting all the rows with the words and
    > copying into a blank worksheet.
    > Is there an easy way to achieve this or is a macro required. If macro
    > required, any help on the below macro would be great.
    >
    > Sub ProvSumCopy()
    > Dim rng As Range
    > Dim cell As Range
    > Dim start_str As Integer
    >
    > Set rng = Selection
    > For Each cell In rng
    > start_str = InStr(cell.Value, "PROVISIONAL SUM")
    > If start_str Then
    > ActiveRow.Select
    > End If
    > start_str = InStr(cell.Value, "PROVISIONAL QUANTITY")
    > If start_str Then
    > ActiveRow.Select
    > End If
    >
    > Next
    >
    > End Sub
    >
    > Thanks
    > Troy
    >
    >
    >
    >
    >
    >
    >
    >
    >




+ 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