Option Base 1
Sub Matrix_2_Array()
Dim xArray As Variant
Dim xRange As Range, yRange As Range
Dim r As Double, c As Double
Dim i As Double, j As Double, k As Double
Set xRange = Range("A1:E5") 'matrix location
Set yRange = Range("G1") 'output location
r = xRange.Rows.Count
c = xRange.Columns.Count
ReDim xArray(r, c)
xArray = xRange.Value 'Notice how I populate the array without looping.
For i = 2 To UBound(xArray, 1)
For j = 2 To UBound(xArray, 2)
If Not xArray(i, j) = 0 Then
With yRange
.Offset(k, 0).Value = xArray(i, 1)
.Offset(k, 1).Value = xArray(1, j)
.Offset(k, 2).Value = xArray(i, j)
End With
k = k + 1
End If
Next j
Next I
End Sub