Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Hide row if column does"not" contain

Martin, thank you very much.

Greg

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chg 1 "Last, First Mid" column to 3 "First", "Middle", "Last" colu JBird11002 Excel Discussion (Misc queries) 4 August 15th 08 06:31 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Hide a column "if"? tgcali Excel Discussion (Misc queries) 11 May 8th 08 09:08 PM
How do I change the column heading in Excel to display "A" "B" "C Thai New Users to Excel 1 November 30th 07 08:06 PM
How do I split "A1B2" into "A1" and "B2" using text to column fun. Jennifer Excel Programming 1 February 2nd 05 10:01 PM


All times are GMT +1. The time now is 10:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"