+ Reply to Thread
Results 1 to 4 of 4

Filter text from a multivalued cell

Hybrid View

  1. #1
    Registered User
    Join Date
    01-09-2014
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    2

    Filter text from a multivalued cell

    Hi

    i am in search of macro which would fetch me a searched text from a multivalued column.The search result shoudl hide all other rows which does display the match

    In the below example i am searching for text "TOP" from the 6 row
    Before.jpg

    after search the output retures me 3 rows
    After.jpg

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Filter text from a multivalued cell

    Hi
    this macro will delete the entire row of any cell in the selected range that doe not include "top" - is that what you want?

    Sub delete_rows()
    Dim cc As Range
    For Each cc In Selection.Cells
        If Replace(cc, "top", "") = cc Then cc.EntireRow.Delete
    Next cc
    End Sub

  3. #3
    Registered User
    Join Date
    01-09-2014
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Filter text from a multivalued cell

    Thanks Nicky for your reply, but this does not help me.

    Let me rephrase my problem statement.

    Macro will do the floowing task.

    1.Search a text from a particular column. and
    2.Displayed only the those rows which matches the text


    Note : The cell in a column could have multiple values.


    example: Macro after searching a text "Top" say, column "D" the resultant output will display rows having "Top" in column D ...like xyztop, topxyz...top-xyz , xyz-top....or just top ..all other rows not matching are hidden(or not displayed)

  4. #4
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Filter text from a multivalued cell

    Hi
    I'm not quite sure what you mean by "displayed"

    this macro will hide all rows in the selected cells not contaning "top":

    Sub hide_rows()
    Dim cc As Range
    For Each cc In Selection.Cells
        If Replace(cc, "top", "") = cc Then cc.EntireRow.Hidden = True
    Next cc
    End Sub

    and this will copy all cells including "top" into a new column, starting at cell D2 (or change "destcell" to suit)

    Sub copy_values()
    Dim cc As Range, x As Long, DestCell As Range
    Set DestCell = Range("D2")
    For Each cc In Selection.Cells
        If Replace(cc, "top", "") <> cc Then
            cc.Copy Destination:=DestCell
            Set DestCell = DestCell.Offset(1, 0)
        End If
    Next cc
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Protecting and Unprotecting VBA for multivalued lists
    By kraszac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2013, 04:45 PM
  2. Filter Column by Text in Cell
    By unifiedac in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-19-2013, 03:07 PM
  3. Cell which displays the filter in use as text
    By pauldaddyadams in forum Excel General
    Replies: 9
    Last Post: 01-21-2012, 11:01 AM
  4. Formula to filter out text in text & numbers in a cell
    By Clueless in UK in forum Excel General
    Replies: 4
    Last Post: 11-24-2011, 07:09 AM
  5. Cell text as pivottable filter
    By JayJay6 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2011, 08:15 AM

Tags for this Thread

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