View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default hide rows with any dates

One way:

Public Sub SearchAndHide()
Dim rCell As Range
Dim rHide As Range
For Each rCell In Range("A12:A5000")
With rCell
If IsDate(.Value) Then
If rHide Is Nothing Then
Set rHide = .Cells
Else
Set rHide = Union(rHide, .Cells)
End If
End If
End With
Next rCell
If Not rHide Is Nothing Then _
rHide.EntireRow.Hidden = True
End Sub


In article ,
acarril wrote:

I've been using vb to find rows and hide them based on key text. I now
need to hide rows based on a date (they vary). Can someone please
help?
Sub search()
Dim cell As Range
Application.ScreenUpdating = False
For Each cell In Range("A12:A5000")
If cell.Value = "RTRSSTCK" Then
cell.EntireRow.Hidden = True
ElseIf cell.Value = 1 Then
cell.EntireRow.Hidden = False
End If
Next
Application.ScreenUpdating = True
End Sub


---
Message posted from http://www.ExcelForum.com/