Option Explicit
Sub gpeTKB()
Dim Sh As Worksheet, Cls As Range, Rng As Range, Clls As Range, Cll As Range
Dim Rws As Long, STT As Byte, Ch As Byte
Dim SoLop As Byte, Cot As Byte, Hg As Byte, ChLe As Byte
ReDim mLop(1 To 9) As String
Set Sh = ThisWorkbook.Worksheets("TKB")
Rws = Sh.[A65500].End(xlUp).Row + 9
Union(Sh.[c5].Resize(Rws, 6), Sh.[k5].Resize(Rws, 6)).ClearContents
Sheets("DaTa").Select
For Each Clls In Range([b5], [b5].End(xlDown))
Rws = Clls.Row
Sh.Cells(3 * Rws - 10, "A").Resize(3).Value = Clls.Value
Set Rng = Range(Cells(Rws, "C"), _
Cells(Rws, "iu").End(xlToLeft)).SpecialCells(xlCellTypeConstants, 2)
SoLop = Rng.Count
For Each Cll In Rng
STT = STT + 1
mLop(STT) = Cells(4, Cll.Column).Value
Next Cll
STT = 0
ChLe = IIf(SoLop Mod 2 = 0, 2, 3)
For Cot = 1 To 3
For Hg = 1 To ChLe
STT = 1 + STT
If Left(mLop(STT), 1) = "7" Or Left(mLop(STT), 1) = "8" Then
Ch = 8
Else
Ch = 0
End If
Sh.Cells(3 * Rws - 10 + Hg - 1, "B").Offset(, Cot + Ch).Value = mLop(STT)
mLop(STT) = "" '<=|'
Next Hg
If STT >= SoLop Then Exit For
Next Cot
Sh.Cells(3 * Rws - 10, "H").Value = Rng.Count
STT = 0
Next Clls
Sh.Select
End Sub