Transposition Automatique

druchmoain

XLDnaute Junior
Bonjour,

comment faire pour la ligne 9, puis la ligne 10 ….(le fichier complet comprend 18000 lignes)

pour que je transpose AUTOMATIQUEMENT, la ligne9 en U9, puis la ligne10 (20 lignes plus bas) en U29 …

Le plus serait que losque la cellule est vide (ex: L9), on ne laisse pas de lignes vides.

Merci d'avance, si vous avez des idées pour solutionner le problème.

PS: j'explique très TRES mal, mais c'est plus comprehensible avec le fichier joint
 

Pièces jointes

  • Transposition Automatique.xlsx
    23.8 KB · Affichages: 91
Dernière édition:

Efgé

XLDnaute Barbatruc
Re : Transposition Automatique

Bonjour druchmoain

Une proposition par macro :

VB:
Sub test()
Dim I&, X&, T As Variant
Application.ScreenUpdating = False
With Sheets("Feuil1")
    For I = 9 To .Cells(.Rows.Count, 1).End(3).Row
        T = .Range(.Cells(I, 1), .Cells(I, 20))
        X = .Cells(.Rows.Count, 21).End(3)(2).Row
        X = IIf(X < 9, 9, X)
        .Cells(X, 21).Resize(UBound(T, 2), 1) = Application.Transpose(T)
    Next I
End With
Application.ScreenUpdating = True
End Sub


Pour lancer le code Alt + F8 et lancer Test.

Cordialement

EDIT Bonjour MRomain :) :D
 

Pièces jointes

  • Transposition_Automatique(2).xls
    44 KB · Affichages: 71
Dernière édition:

druchmoain

XLDnaute Junior
Re : Transposition Automatique

La même macro, mais en laissant les lignes vides !

Merci Efgé

Bonjour druchmoain

Une proposition par macro :

VB:
Sub test()
Dim I&, X&, T As Variant
Application.ScreenUpdating = False
With Sheets("Feuil1")
    For I = 9 To .Cells(.Rows.Count, 1).End(3).Row
        T = .Range(.Cells(I, 1), .Cells(I, 20))
        X = .Cells(.Rows.Count, 21).End(3)(2).Row
        X = IIf(X < 9, 9, X)
        .Cells(X, 21).Resize(UBound(T, 2), 1) = Application.Transpose(T)
    Next I
End With
Application.ScreenUpdating = True
End Sub


Pour lancer le code Alt + F8 et lancer Test.

Cordialement

EDIT Bonjour MRomain :) :D
 
Dernière édition:

Efgé

XLDnaute Barbatruc
Re : Transposition Automatique

Re

Pour garder les "Balncs" :
VB:
Sub test2()
Dim I&, X&, T As Variant
Application.ScreenUpdating = False
X = -11
With Sheets("Feuil1")
    For I = 9 To .Cells(.Rows.Count, 1).End(3).Row
        T = .Range(.Cells(I, 1), .Cells(I, 20))
        X = X + 20
        .Cells(X, 21).Resize(UBound(T, 2), 1) = Application.Transpose(T)
    Next I
End With
Application.ScreenUpdating = True
End Sub
Cordialement
 

druchmoain

XLDnaute Junior
Re : Transposition Automatique

Merci infiniment,
bonne soirée !

Re

Pour garder les "Balncs" :
VB:
Sub test2()
Dim I&, X&, T As Variant
Application.ScreenUpdating = False
X = -11
With Sheets("Feuil1")
    For I = 9 To .Cells(.Rows.Count, 1).End(3).Row
        T = .Range(.Cells(I, 1), .Cells(I, 20))
        X = X + 20
        .Cells(X, 21).Resize(UBound(T, 2), 1) = Application.Transpose(T)
    Next I
End With
Application.ScreenUpdating = True
End Sub
Cordialement
 

Discussions similaires

Réponses
18
Affichages
722

Statistiques des forums

Discussions
312 412
Messages
2 088 195
Membres
103 763
dernier inscrit
p.michaux