Public Sub GPE_HideRow()
Dim S As String, i As Integer, Arr(), j As Integer, n As Integer, kt As Boolean
Dim sRng As Range
For i = 1 To 11 'Neu muon bo sheet11 thì thay so 11 thanh so 10
Set sRng = Nothing
With Sheets("KC_CD" & i)
.Cells.EntireRow.Hidden = False
S = "A16:N" & .Range("A1000").End(xlUp).Offset(-7).Row
Arr = .Range(S).Value
For j = 1 To UBound(Arr)
kt = True
For n = 3 To 14
If Arr(j, n) <> Empty Then
kt = False
Exit For
End If
Next n
If kt And (((Arr(j, 1) <> "") And (Arr(j, 2) <> "")) Or ((Arr(j, 1) = "") And (Arr(j, 2) = ""))) Then
If j < UBound(Arr) Then
If (Arr(j, 1) <> "") And (Arr(j, 2) <> "") And (Arr(j + 1, 1) = "") And (Arr(j + 1, 2) = "") Then
For n = 3 To 14
If Arr(j + 1, n) <> "" Then GoTo Andong
Next n
End If
End If
If sRng Is Nothing Then
Set sRng = .Range((15 + j) & ":" & (15 + j))
Else
Set sRng = Union(sRng, .Range((15 + j) & ":" & (15 + j)))
End If
End If
Andong:
Next j
If Not sRng Is Nothing Then sRng.EntireRow.Hidden = True
End With
Next i
End Sub