Closed Thread
Results 1 to 3 of 3

Hide row if column does"not" contain

  1. #1
    GregR
    Guest

    Hide row if column does"not" contain

    I have a column of PO numbers all containing 9 digits, like 605031101.
    The sixth and seventh digits, in the example "11", represents the
    month, Nov. I want to hide all rows that do "not" contain 11, 10 or 09,
    Nov, Oct and Sep. How? TIA


  2. #2
    Martin Fishlock
    Guest

    RE: Hide row if column does"not" contain

    Try this bit of code:

    It assumes the cell pointer is on the first cell and the end sell is blank.

    The months are hard codes but you could change this with a little form.

    Option Explicit
    Sub Hiderow()
    Dim cur_row As Long
    Dim cur_col As Long
    cur_row = ActiveCell.Row
    cur_col = ActiveCell.Column
    While Cells(cur_row, cur_col) <> ""
    Select Case Mid(Cells(cur_row, cur_col), 6, 2)
    Case 9 To 11
    ' ok do nothing
    Case Else
    Rows(cur_row).Hidden = True
    End Select
    If cur_row = 65536 Then Exit Sub
    cur_row = cur_row + 1
    Wend
    End Sub



    "GregR" wrote:

    > I have a column of PO numbers all containing 9 digits, like 605031101.
    > The sixth and seventh digits, in the example "11", represents the
    > month, Nov. I want to hide all rows that do "not" contain 11, 10 or 09,
    > Nov, Oct and Sep. How? TIA
    >
    >


  3. #3
    GregR
    Guest

    Re: Hide row if column does"not" contain

    Martin, thank you very much.

    Greg


Closed 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