Sub LocGV()
Dim i&, j&, k&, t&, Lr&, Lc&
Dim Arr(), KQ(), Dic As Object, Ws As Worksheet
Set Dic = CreateObject("Scripting.Dictionary")
With Sheets("TKB_T10")
Lr = .Cells(Rows.Count, 2).End(xlUp).Row + 5
Arr = .Range("B20:T" & Lr).Value
End With
ReDim KQ(1 To UBound(Arr), 1 To 3)
n = UBound(Arr) / 35
For i = 1 To n
For j = (i * 35) - 34 To i * 35
For k = 1 To UBound(Arr, 2)
If Arr(j, k) <> "" Then
If Len(Trim(Arr(j, k))) > 2 Then
keys = Arr(j, k)
If Not Dic.Exists(keys) Then
t = t + 1
Dic.Add (keys), t
Temp = Split(keys, "-")
KQ(t, 1) = t
KQ(t, 2) = Temp(1)
KQ(t, 3) = Temp(0)
End If
End If
End If
Next k
Next j
Set Ws = Sheets.Add(After:=Sheets(Worksheets.Count))
Ws.[A1] = "TT"
Ws.[B1] = "Ho và tên"
Ws.[C1] = "GV môn"
Ws.[A2].Resize(t, 3) = KQ
Ws.Name = "T" & i
Next i
Set Dic = Nothing
MsgBox "Xong"
End Sub