Loop
Hi
try something like the following instead:
Private Sub Workbook_Open()
Dim wks As Worksheet
Dim RowNdx As Long
Dim LastRow As Long
Application.ScreenUpdating = False
Set wks = Worksheets("Exam Timetable")
With wks
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For RowNdx = LastRow To 2 Step -1
If .Cells(RowNdx, "A").Value < Date Or _
.Cells(RowNdx, "A").Value = "N/A" Then
.Rows(RowNdx).Hidden = True
End If
Next RowNdx
Application.ScreenUpdating = True
End Sub
-----Original Message-----
The following code looks to see if an exam has gone or if
there wasnt an
exam for that subjuect, hides the row the moves on untill
the cell is blank.
However, when i run it, it goes into a continues loop.
Any ideas as to why?
Thanks.
Private Sub Workbook_Open()
Application.ScreenUpdating = False
Sheets("Exam Timetable").Select
Range("A2").Select
Do
If ActiveCell.Value < Date Or ActiveCell.Value
= "N/A" Then
Selection.EntireRow.Hidden = True
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell.Value = ""
End Sub
--
Cheers,
Ben
Remove your.tonsils to reply
"You only live once but if you do it right once is
enough!"
.
|