Sub [B]nhaloc_toanboSheet[/B]()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Bao cao chung" Then
'MsgBox ws.Name 'kiem tra ten tung` sheet
Call Unprotect_1sheet(ws)
Call Nhaloc_1Sheet(ws, ws.Range("A1:A1000"))
Call Protect_1sheet(ws)
End If
Next
MsgBox "Da~ nha loc toan bo sheet", vbInformation
End Sub
Sub [B]Nhaloc_1Sheet[/B](iSheet As Worksheet, vung As Range) '"Clear Filter/ Unhide Rows"
On Error GoTo Next_ 'xay ra loi~ neu ko co' bo loc.
If iSheet.FilterMode Then iSheet.ShowAllData 'phai mo? khoa' truoc' '|| dang dung` Filter
Next_:
'----------
'Cells.EntireRow.Hidden = False '|| Hide Row
vung.EntireRow.Hidden = False
'MsgBox "da~ nha loc"
End Sub
Sub [B]Unprotect_1sheet[/B](iSheet As Worksheet) 'any Sheet
iSheet.Unprotect Password:=1
End Sub
Sub [B]Protect_1sheet[/B](iSheet As Worksheet) 'any Sheet
With iSheet
.Protect Password:=1, AllowFiltering:=True 'cho phep' loc
End With
End Sub