zebanx
XLDnaute Accro
Bonsoir à tous,
J'ai eu le privilège de bénéficier de nombreuses réponses sur les transpositions (liste non exhaustive : mapomme, klin89, pierre-jean...) dont je remercie encore les auteurs ...
mais pas certain d'avoir vu une transposition de données comme celle présentée sur le tableau suivant, c'est à dire avec des cellules de données comprenant plusieurs valeurs.
Est-il facile de transposer avec ce "montage" SVP ?
Vous remerciant par avance pour vos commentaires / réponses, bonne soirée,
zebanx
Pour info, je me permets de fournir un code de Klin89 pour une transposition d'un tableau à double entrée "simple" (1 ligne en haut, 1 colonne à gauche et toutes les données du tableau).
J'ai eu le privilège de bénéficier de nombreuses réponses sur les transpositions (liste non exhaustive : mapomme, klin89, pierre-jean...) dont je remercie encore les auteurs ...
mais pas certain d'avoir vu une transposition de données comme celle présentée sur le tableau suivant, c'est à dire avec des cellules de données comprenant plusieurs valeurs.
Est-il facile de transposer avec ce "montage" SVP ?
Vous remerciant par avance pour vos commentaires / réponses, bonne soirée,
zebanx
Pour info, je me permets de fournir un code de Klin89 pour une transposition d'un tableau à double entrée "simple" (1 ligne en haut, 1 colonne à gauche et toutes les données du tableau).
Code:
Sub sh03_transpose()
'fait par klin89
Dim a, i As Long, j As Long, b(), n As Long
a = Sheets("sh03_brut").Range("b2").CurrentRegion.Value
ReDim b(1 To UBound(a, 1) * UBound(a, 2), 1 To 3)
For j = 2 To UBound(a, 2)
For i = 2 To UBound(a, 1)
If Not IsEmpty(a(i, j)) Then
n = n + 1
b(n, 1) = a(1, j)
b(n, 2) = a(i, 1)
b(n, 3) = a(i, j)
End If
Next
Next
'Restitution
With Sheets("sh03_res").Cells(1).Resize(n, 3)
.CurrentRegion.ClearContents
.Value = b
End With
End Sub
Pièces jointes
Dernière édition: