Consulting

Results 1 to 3 of 3

Thread: Hide Row if cell has specified word

  1. #1
    VBAX Regular
    Joined
    May 2007
    Posts
    72
    Location

    Hide Row if cell has specified word

    I need to hide any row that (in column I) contains the word Comp, however the cell may also include other words, i.e. "Aspirational Comp", or "Better Comp" and all of these have to be hidden, but only in a specified range from row 300 to the end of the spreadsheet.
    Any suggestions?
    Thank you,

  2. #2
    Knowledge Base Approver
    The King of Overkill!
    VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    Hi agnesz,

    What about using AutoFilter? Create a custom autofilter and have it Show rows where: <column I> does not contain: "comp"
    Matt

  3. #3
    [vba]
    Sub Conceal()
    Dim i As Long
    Dim lastrow As Long
    Dim c As Range
    Dim rng As Range
    lastrow = Cells(Rows.Count, "I").End(xlUp).Row
    For i = 300 To lastrow
    If Cells(i, "I").Text = "Comp" Or Cells(i, "I").Text = "Aspirational Comp" _
    Or Cells(i, "I").Text = "Better Comp" Then
    Cells(i, "I").EntireRow.Hidden = True
    End If
    Next i
    End Sub
    [/vba]

    edited for details' 4:49pm
    Last edited by YellowLabPro; 08-03-2007 at 01:49 PM.
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

Posting Permissions

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