Option Explicit
Dim MyColor As Byte
Sub BaSoDinhTamGiac()
Const gN As String = "-"
Dim Hg As Byte: Dim Cot As Byte
Dim Rng As Range, Cll0 As Range, Cll2 As Range, sRng As Range
Set Rng = Range("A1:J10").SpecialCells(xlCellTypeConstants, 3)
Range("L1:L99").ClearContents
MyColor = [l2].Interior.ColorIndex + 1: If MyColor = 41 Then MyColor = 34
For Each Cll0 In Rng
Cot = Cll0.Column: Hg = Cll0.Row
If Hg = 10 Then GoTo GPE
Set sRng = Range(Cells(Hg + 1, 1), Cells(10, Cot))
For Each Cll2 In sRng
If Not Intersect(Cll2, Rng) Is Nothing And Not Intersect(Cells(Cll2.Row, _
Cot), Rng) Is Nothing And Cll2.Column < Cll0.Column Then
[l65500].End(xlUp).Offset(1) = Cll2.Value & gN & Cll0.Value _
& gN & Cells(Cll2.Row, Cot).Value
End If
Next Cll2
GPE: Next Cll0
Range("L2:l" & [l65500].End(xlUp).Row).Interior.ColorIndex = MyColor
End Sub