Salut Nana,
Salut Jean-Eric,
comme certains disent, un peu capillotracté, mais, au moins, j'utilise des formules... quelque part...
Je postule que ton tableau est en [A1].
Un double-clic démarre la macro.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'
Dim tTab, tExtract, iRow%, iCol%, iNb%, iNbR%, iIdxC%, iIdxR%
'
Cancel = True
Application.ScreenUpdating = False
'
iRow = Range("A" & Rows.Count).End(xlUp).Row
iCol = Cells(1, Columns.Count).End(xlToLeft).Column
Range(fctCol(iCol + 1) & 1).Value = 0
Range(fctCol(iCol + 1) & 2).FormulaLocal = "=si(A2=A1;" & fctCol(iCol + 1) & "1;" & fctCol(iCol + 1) & "1+1)"
Range(fctCol(iCol + 2) & 2).FormulaLocal = "=nb.si($A$2:$A$" & iRow & ";$A2)"
Range(fctCol(iCol + 1) & 2).Resize(1, 2).AutoFill Destination:=Range(fctCol(iCol + 1) & 2).Resize(iRow - 1, 2)
iNb = WorksheetFunction.Max(Columns(fctCol(iCol + 1)))
iNbR = WorksheetFunction.Max(Columns(fctCol(iCol + 2))) + 1
Columns(fctCol(iCol + 1) & ":" & fctCol(iCol + 2)).Delete shift:=xlToLeft
'
tTab = Range("A1").CurrentRegion.Value
tExtract = Range("AA1").Resize(iNbR, (iCol - 1) * iNb).Value
For x = 2 To UBound(tTab, 2)
For y = 2 To UBound(tTab, 1)
If tTab(y, 1) <> tTab(y - 1, 1) Then _
iIdxC = iIdxC + 1: _
iIdxR = 1: _
tExtract(1, iIdxC) = tTab(1, x) & " " & tTab(y, 1)
iIdxR = iIdxR + 1
tExtract(iIdxR, iIdxC) = tTab(y, x)
Next
Next
'
With Worksheets("Extract")
.Cells.Delete
.Range("A1").Resize(UBound(tExtract, 1), UBound(tExtract, 2)).Value = tExtract
.Activate
End With
'
Application.ScreenUpdating = True
'
End Sub
A+