Consulting

Results 1 to 4 of 4

Thread: Hide Rows based several values

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

    Hide Rows based several values

    I need to hide a row if any of the rows 195 through 796 in column I contains any of the following words:
    Mike
    Sunny
    Patti
    Dennis, etc.
    Please help!
    Thank you,
    az

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    [vba]

    Sub ProcessData()
    Dim i As Long
    Dim ary

    Application.ScreenUpdating = False

    ary = Array("Mike", "Sunny", "Patti", "Dennis")

    For i = 796 To 195 Step -1

    If Not IsError(Application.Match(Cells(i, "I").Value, ary, 0)) Then
    Rows(i).Delete
    End If
    Next i

    Application.ScreenUpdating = True
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    May 2007
    Posts
    72
    Location
    I just want to hide the row though, not delete it...
    Can you adjust the code?
    thanks so much!

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    [vba]

    Rows(i).Hidden = True
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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