Bonjour,
Un exemple VBA pour normaliser tes données.
Cdlt.
Option Explicit
Private Sub cmdNormalizeData_Click()
Dim wsTable As Worksheet
Dim rStart As Range
Dim tbl As Variant, Arr() As Variant
Dim I As Long, J As Long, k As Long
Application.ScreenUpdating = False
Set wsTable = ActiveWorkbook.Worksheets("DONNEES NORMALISEES")
With wsTable.ListObjects(1)
If Not .DataBodyRange Is Nothing Then .DataBodyRange.Delete
Set rStart = .InsertRowRange.Cells(1)
End With
tbl = Me.ListObjects(1).Range.Value
For I = 2 To UBound(tbl)
For J = 3 To UBound(tbl, 2)
If tbl(I, J) <> "" Then
ReDim Preserve Arr(4, k + 1)
Arr(0, k) = tbl(I, 1)
Arr(1, k) = tbl(I, 2)
Arr(2, k) = tbl(1, J)
Arr(3, k) = tbl(I, J)
k = k + 1
End If
Next J
Next I
If k > 0 Then
rStart.Resize(UBound(Arr, 2), 4).Value = Application.Transpose(Arr)
With wsTable
.Activate
.[A1].Select
End With
Else
MsgBox "Il n'y a pas de données à normaliser..."
End If
Erase Arr
Set rStart = Nothing
Set wsTable = Nothing
End Sub