![]() |
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 |
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 |
Hide row if column does"not" contain
Martin, thank you very much.
Greg |
All times are GMT +1. The time now is 06:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com