slt studerd, slt vince,
un essai en VBA
Sub transformerColLigne()
Dim x As Worksheet, y As Worksheet
Dim i As Integer, j As Integer, k As Integer, lastrow_x As Integer, lastrow_y As Integer, lastcol_x As Integer
Dim z As Range
Dim FillRange As Variant
Set x = ThisWorkbook.Sheets(1)
Set y = ThisWorkbook.Sheets(2)
Set z = x.UsedRange
Application.ScreenUpdating = False
lastrow_x = z.Rows.Count + 2
lastcol_x = z.Columns.Count + 2
y.Range("D:G").ClearContents
FillRange = VBA.Array("Pas", "Periode", "categorie", "valeur")
y.Range("D4:G4").Value = FillRange
lastrow_y = y.Range("D1").Rows.Count + 4
k = 4
For i = 3 To lastcol_x - 2
For j = 4 To lastrow_x
If x.Cells(i, 3).Value <> 0 Then
y.Cells(lastrow_y, 4).Value = x.Cells(j, 3).Value
y.Cells(lastrow_y, 5).Value = x.Cells(j, 4).Value
y.Cells(lastrow_y, 6).Value = x.Cells(k, 4).Value
y.Cells(lastrow_y, 7).Value = x.Cells(j, i + 2).Value
lastrow_y = lastrow_y + 1
End If
Next j
k = k + 1
Next i
Application.ScreenUpdating = True
End Sub