Please come back to me if this goes over your head but this VBA code will do what you need providing the following is true:
Row 1 is for column headers
Column A is Name
Column B is Date
Column C is Lesson
Column D is Status
Sub HideRows()
'Determine Last Row
Range("A1").Select
Selection.End(xlDown).Select
LastRow = ActiveCell.Row
'Loop through all rows and put lesson number in column E
'If lesson has been mastered
Dim cell As Range
For x = 2 To LastRow
LessonNo = Cells(x, 3).Value
If Cells(x, 4).Value = "mastered" Then
Cells(x, 5).Value = LessonNo
End If
Next
'Now loop through rows again and if the lesson number has been
'entered into column E then hide that row
For x = 2 To LastRow
LessonNo = Cells(x, 3).Value
If Application.WorksheetFunction.CountIf(Range("E:E"), LessonNo) = 1 Then
ActiveSheet.Rows(x).Hidden = True
End If
Next
'Tidy column E so it doesn't show the lessonnumbers previously added by
'Macro
Range("E:E").ClearContents
End Sub
Sub UnhideAllRows()
Cells.Select
Selection.EntireRow.Hidden = False
End Sub
Bookmarks