The filter does seem be OK. I have another macro to show only discharged patients, and it works.
However, there are merged cells in the table which are affected by the autofilter (i.e. patient name is 5 merged cells, and there are others). Each of the lines related to the patient name turn to 0 once the patient has discharged.
Sub ShowDischarged()
ActiveSheet.Unprotect Password:="BEC"
ActiveSheet.AutoFilterMode = False
ActiveSheet.Range("$AJ$1:$AJ$1000000").Autofilter Field:=1, Criteria1:="0"
Range("B4:B8").Select
ActiveSheet.Protect Password:="BEC"
End Sub
Bookmarks