Public Sub TransposeData()
Dim ws As Worksheet, ws2 As Worksheet, tbl As Variant, arr() As Variant, I As Long, J As Long, k As Long
Set ws = Worksheets("Source"): Set ws2 = Worksheets("Copy")
tbl = ws.Cells(1).CurrentRegion.Value2
For I = 2 To UBound(tbl)
For J = 2 To UBound(tbl, 2)
If tbl(I, J) <> "" Then
ReDim Preserve arr(3, k + 1)
arr(0, k) = tbl(I, 1)
arr(1, k) = tbl(I, J)
arr(2, k) = Replace(tbl(1, J), "Rule ", "")
k = k + 1
End If
Next J
Next I
With ws2
.Cells(1).CurrentRegion.ClearContents
If k > 0 Then
.Cells(1).Resize(, 3).Value = Array("Attibute", "Rule", "Rule type")
.Cells(2, 1).Resize(k, 3).Value = Application.Transpose(arr)
.Activate
.Cells(1).Select
End If
End With
End Sub