Option Explicit
Sub danh_dau()
Dim dich() As Variant
Dim nguon As Range, o As Range
Dim i, j, n, m, col As Long
With Sheet1
n = .Range("B4", Cells(.Rows.Count, 2).End(xlUp)).Rows.Count
Set nguon = .Range("B4", Cells(.Rows.Count, 2).End(xlUp))
col = .Range("D3", Range("D3").End(xlToRight)).Columns.Count
End With
ReDim dich(1 To n, 1 To col)
For i = 1 To n
For j = 1 To col
dich(i, j) = "x"
Next j
Next i
For Each o In nguon
i = o.Row - 3
If o.Value = "n" Then
For m = 1 To col
dich(i, m) = ""
Next m
Else
For j = 1 To Len(o)
If IsNumeric(Mid(nguon(i), j, 1)) Then
dich(i, CInt(Mid(nguon(i), j, 1))) = ""
End If
Next j
End If
Next o
Range("D4").Resize(n, col).Value = dich
Erase dich
End Sub