Sub Button28_Click()
Range("A18:U9999").Clear
Range("K17").Select
ActiveCell.FormulaR1C1 = "=COUNTIF('Chi tiet'!R16C4:R9999C4,'In BK'!R7C19)"
lr = [K16].End(xlDown).Row
For i = lr To 2 Step -1
If Cells(i, 11) > 1 Then
Cells(i + 1, 11).Select
R = Cells(i, 11)
Selection.Resize(Cells(i, 11) - 1, 1).Select
Selection.EntireRow.Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Cells(i, 11).Select
Selection.Value = 1
Selection.Resize(R, 1).Select
Selection.EntireRow.Select
Selection.FillDown
End If
lr = [K16].End(xlDown).Row
Next
For rw = Cells(65536, 14).End(xlDown).Row To 1 Step -1
If Cells(rw, 14).Value = Cells(1, 19).Value Then Cells(rw, 14).Font.FontStyle = "Bold"
If Cells(rw, 14).Value = Cells(1, 19).Value Then Cells(rw, 14).Font.Size = "10"
If Cells(rw, 14).Value = Cells(1, 19).Value Then Cells(rw, 18).Font.FontStyle = "Bold"
If Cells(rw, 14).Value = Cells(1, 19).Value Then Cells(rw, 18).Font.Size = "10"
Next rw
For rw = Cells(65536, 14).End(xlDown).Row To 1 Step -1
If Cells(rw, 14).Value = Cells(1, 19).Value Then Cells(rw - 1, 14).Font.FontStyle = "Bold"
If Cells(rw, 14).Value = Cells(1, 19).Value Then Cells(rw - 1, 14).Font.Size = "10"
If Cells(rw, 14).Value = Cells(1, 19).Value Then Cells(rw - 1, 18).Font.FontStyle = "Bold"
If Cells(rw, 14).Value = Cells(1, 19).Value Then Cells(rw - 1, 18).Font.Size = "10"
Next rw
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "L").End(xlUp).Row
Cells(LastRow + 2, "L").Select
Cells(LastRow + 1, "L") = " " & Sheets("Chi tiet").Cells(15, 26) & Cells(6, 31)
Cells(LastRow + 1, "L").Font.Name = "Times New Roman"
Cells(LastRow + 1, "L").Font.FontStyle = "Italic"
Cells(LastRow + 2, "L") = " " & Sheets("Chi tiet").Cells(15, 23)
Cells(LastRow + 2, "L").Font.Name = "Times New Roman"
Cells(LastRow + 2, "L").Font.FontStyle = "Bold"
Cells(LastRow + 2, "N") = " " & Sheets("Chi tiet").Cells(15, 24)
Cells(LastRow + 2, "N").Font.Name = "Times New Roman"
Cells(LastRow + 2, "N").Font.FontStyle = "Bold"
Cells(LastRow + 2, "Q") = " " & Sheets("Chi tiet").Cells(15, 25)
Cells(LastRow + 2, "Q").Font.Name = "Times New Roman"
Cells(LastRow + 2, "Q").Font.FontStyle = "Bold"
Cells(LastRow + 3, "L") = " " & Sheets("Chi tiet").Cells(15, 27)
Cells(LastRow + 3, "L").Font.Name = "Times New Roman"
Cells(LastRow + 3, "L").Font.FontStyle = "Italic"
Cells(LastRow + 3, "N") = " " & Sheets("Chi tiet").Cells(15, 27)
Cells(LastRow + 3, "N").Font.Name = "Times New Roman"
Cells(LastRow + 3, "N").Font.FontStyle = "Italic"
Cells(LastRow + 3, "Q") = " " & Sheets("Chi tiet").Cells(15, 28)
Cells(LastRow + 3, "Q").Font.Name = "Times New Roman"
Cells(LastRow + 3, "Q").Font.FontStyle = "Italic"
End With
End Sub