Microsoft 365 TS Copie ligne selon condition

  • Initiateur de la discussion Initiateur de la discussion eric72
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

eric72

XLDnaute Accro
Bonjour à tous,
je rencontre un souci, j'ai un TS "TbAlternant", à partir de celui-ci, j'aimerai copier les lignes et les coller dans le TS "TbArchiveAlternant", à condition que le "NOM - PRENOM" n'existe pas déjà dans le TS "TbArchiveAlternant", cela fonctionne assez bien, par contre il y a deux cas ou cela ne fonctionne pas, à savoir:
- Si il n'y a aucune donnée dans "TbAlternant", il n'y a donc aune données à copier, mais ça bug
- Si une seule ligne dans "TbAlternant", à la 1ère exécution, ça fonctionne, à la 2ème exécution ça plante ici.
VB:
TabTransp(1, j) = TabArchiveAlternant(j, 1)
du fait qu'il cherche va jusqu'à la 12ème colonne alors que seulement 11 dans "TbAlternant" et 13 dans "TbArchiveAlternant"
Auriez-vous une petite idée de la raison de ces bugs?
Merci beaucoup pour le temps consacré et bonne journée à tous.
Eric
 

Pièces jointes

Solution
c'est la transposition d'Une ligne qui pose problème

j'ai pas essayé tous les cas de figure
VB:
Option Explicit
Sub Copier_Alternant()

Dim i As Integer
Dim j As Integer
Dim Ind As Integer
Dim NbLig As Integer
Dim Trouvé As Boolean
Dim LigDest As Integer
Dim NomPrenom As String
Dim TSAlternant As ListObject
Dim TSArchiveAlternant As ListObject
Dim TabAlternant() As Variant
Dim TabArchiveAlternant() As Variant
Dim LastLine As Integer
Dim TabNew() As Variant
Dim NbNew As Integer
Dim NbCol As Integer
Application.ScreenUpdating = False

    'Définition des Tables structurées
    Set TSAlternant = Sheets("Import").ListObjects("TbAlternant")
    Set TSArchiveAlternant = Sheets("Archive Alternant").ListObjects("TbArchiveAlternant")...
bonjour

forcément, quand on transfère un tableau de 11 colonnes dans un autre qui en fait 13
il faut modifier la fin de la boucle qui pose problème
VB:
Option Explicit
Sub Copier_Alternant()

Dim i As Integer
Dim j As Integer
Dim Ind As Integer
Dim NbLig As Integer
Dim Trouvé As Boolean
Dim LigDest As Integer
Dim NomPrenom As String
Dim TSAlternant As ListObject
Dim TSArchiveAlternant As ListObject
Dim TabAlternant() As Variant
Dim TabArchiveAlternant() As Variant
Dim LastLine As Integer
Dim TabNew() As Variant
Dim NbNew As Integer
Dim NbCol As Integer
Application.ScreenUpdating = False

    'Définition des Tables structurées
    Set TSAlternant = Sheets("Import").ListObjects("TbAlternant")
    Set TSArchiveAlternant = Sheets("Archive Alternant").ListObjects("TbArchiveAlternant")
    
    With TSAlternant 'avec la TS "TSAlternant"
    
    'MsgBox TSAlternant.ListColumns(1).DataBodyRange(1)

        TabAlternant = .DataBodyRange.Value2 '.ListColumns(1).DataBodyRange.Resize(, 11).Value 'on met tout (sauf la ligne d'entete) dans un tablo VBA
    End With
    With TSArchiveAlternant 'avec la TS "TSArchiveAlternant"
        If .ListRows.Count = 0 Then 'la table Maj est vide
            'on copie directement le contenu de la commande vers Maj
            .ListRows.Add 'on ajoute une ligne vide
            .DataBodyRange(1, 1).Resize(UBound(TabAlternant, 1), UBound(TabAlternant, 2)) = TabAlternant 'on colle directement le TabAlternant
            'MsgBox "durée du traitement: " & Timer - start & " secondes"
            Application.ScreenUpdating = True
            Exit Sub ' et c'est fini
        Else
            TabArchiveAlternant = Application.WorksheetFunction.Transpose(.DataBodyRange) 'on met tout (sauf la ligne d'entete) dans un tablo VBA
            NbLig = UBound(TabArchiveAlternant, 2) 'on récupère le nombre de lignes
        End If
    End With
    
    NbCol = UBound(TabAlternant, 2) 'on récupère le nombre de colonnes
    
    NbNew = 0 'initialisation du nombre de nouvelles lignes
    For i = LBound(TabAlternant, 1) To UBound(TabAlternant, 1) 'pour chaque ligne du tablo
        NomPrenom = TabAlternant(i, 1) 'on récupère la Ref dans la colonne 1
        Trouvé = False 'initialisation
        For Ind = LBound(TabArchiveAlternant, 2) To UBound(TabArchiveAlternant, 2)  'on cherche si la référence est déjà dans le tablo TabArchiveAlternant
            If TabArchiveAlternant(1, Ind) = NomPrenom Then 'on la trouve
                LigDest = Ind 'on note la ligne
                Trouvé = True 'on met à vrai
                Exit For 'on sort de la boucle
            End If
        Next Ind
        
        If Not Trouvé Then 'si pas trouvé alors qu'on a parcouru TOUT le tablo
            NbNew = NbNew + 1 'on ajoute une ligne
            ReDim Preserve TabNew(1 To NbCol, 1 To NbNew) 'on dimensionne le tablo NbNew
            For j = LBound(TabAlternant, 2) To UBound(TabAlternant, 2) 'on rempli avec TOUTE la ligne
                TabNew(j, NbNew) = TabAlternant(i, j)
            Next j
        Else 'on ne remplit que certaines colonnes
            For j = 1 To 11 'on remplit les infos pour les colonnes [NOM - PRENOM]:[COMMENTAIRES] COL 1 à COL 11
                TabArchiveAlternant(j, LigDest) = TabAlternant(i, j)
            Next j
        End If
    Next i
    
    With TSArchiveAlternant 'avec la table
        Dim ListCol
        Dim ExtractCol
        Dim TabTransp
        
        ListCol = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) 'liste des colonnes à extraire du tablo
        
        If .ListRows.Count = 1 Then 'si UNE seule ligne dans TSArchiveAlternant (avant le transfert) ==> le transpose d'une ligne vers une colonne ne fonctionne pas ==> on créé manuellement le tabtransp
            ReDim TabTransp(1 To 1, 1 To NbCol)
            For j = LBound(TabArchiveAlternant, 1) To NbCol
                TabTransp(1, j) = TabArchiveAlternant(j, 1)
            Next j
        Else
            TabTransp = Application.WorksheetFunction.Transpose(TabArchiveAlternant) 'on peut directement transposer
        End If
        
        ExtractCol = Application.Index(TabTransp, Evaluate("row(1:" & UBound(TabTransp) & ")"), ListCol) 'on extrait les colonnes
        .DataBodyRange(1, 1).Resize(UBound(ExtractCol, 1), 11) = ExtractCol 'on bascule le résultat
        
        

        If NbNew <> 0 Then 'si on a des nouvelles lignes ==> on les colle en bas de tablo
            LastLine = .ListRows.Add.Index
            .DataBodyRange(LastLine, 1).Resize(UBound(TabNew, 2), UBound(TabNew, 1)) = Application.WorksheetFunction.Transpose(TabNew)
        End If
    End With

    'MsgBox "durée du traitement: " & Timer - start & " secondes"
    Application.ScreenUpdating = True

End Sub
 
bonjour

forcément, quand on transfère un tableau de 11 colonnes dans un autre qui en fait 13
il faut modifier la fin de la boucle qui pose problème
VB:
Option Explicit
Sub Copier_Alternant()

Dim i As Integer
Dim j As Integer
Dim Ind As Integer
Dim NbLig As Integer
Dim Trouvé As Boolean
Dim LigDest As Integer
Dim NomPrenom As String
Dim TSAlternant As ListObject
Dim TSArchiveAlternant As ListObject
Dim TabAlternant() As Variant
Dim TabArchiveAlternant() As Variant
Dim LastLine As Integer
Dim TabNew() As Variant
Dim NbNew As Integer
Dim NbCol As Integer
Application.ScreenUpdating = False

    'Définition des Tables structurées
    Set TSAlternant = Sheets("Import").ListObjects("TbAlternant")
    Set TSArchiveAlternant = Sheets("Archive Alternant").ListObjects("TbArchiveAlternant")
   
    With TSAlternant 'avec la TS "TSAlternant"
   
    'MsgBox TSAlternant.ListColumns(1).DataBodyRange(1)

        TabAlternant = .DataBodyRange.Value2 '.ListColumns(1).DataBodyRange.Resize(, 11).Value 'on met tout (sauf la ligne d'entete) dans un tablo VBA
    End With
    With TSArchiveAlternant 'avec la TS "TSArchiveAlternant"
        If .ListRows.Count = 0 Then 'la table Maj est vide
            'on copie directement le contenu de la commande vers Maj
            .ListRows.Add 'on ajoute une ligne vide
            .DataBodyRange(1, 1).Resize(UBound(TabAlternant, 1), UBound(TabAlternant, 2)) = TabAlternant 'on colle directement le TabAlternant
            'MsgBox "durée du traitement: " & Timer - start & " secondes"
            Application.ScreenUpdating = True
            Exit Sub ' et c'est fini
        Else
            TabArchiveAlternant = Application.WorksheetFunction.Transpose(.DataBodyRange) 'on met tout (sauf la ligne d'entete) dans un tablo VBA
            NbLig = UBound(TabArchiveAlternant, 2) 'on récupère le nombre de lignes
        End If
    End With
   
    NbCol = UBound(TabAlternant, 2) 'on récupère le nombre de colonnes
   
    NbNew = 0 'initialisation du nombre de nouvelles lignes
    For i = LBound(TabAlternant, 1) To UBound(TabAlternant, 1) 'pour chaque ligne du tablo
        NomPrenom = TabAlternant(i, 1) 'on récupère la Ref dans la colonne 1
        Trouvé = False 'initialisation
        For Ind = LBound(TabArchiveAlternant, 2) To UBound(TabArchiveAlternant, 2)  'on cherche si la référence est déjà dans le tablo TabArchiveAlternant
            If TabArchiveAlternant(1, Ind) = NomPrenom Then 'on la trouve
                LigDest = Ind 'on note la ligne
                Trouvé = True 'on met à vrai
                Exit For 'on sort de la boucle
            End If
        Next Ind
       
        If Not Trouvé Then 'si pas trouvé alors qu'on a parcouru TOUT le tablo
            NbNew = NbNew + 1 'on ajoute une ligne
            ReDim Preserve TabNew(1 To NbCol, 1 To NbNew) 'on dimensionne le tablo NbNew
            For j = LBound(TabAlternant, 2) To UBound(TabAlternant, 2) 'on rempli avec TOUTE la ligne
                TabNew(j, NbNew) = TabAlternant(i, j)
            Next j
        Else 'on ne remplit que certaines colonnes
            For j = 1 To 11 'on remplit les infos pour les colonnes [NOM - PRENOM]:[COMMENTAIRES] COL 1 à COL 11
                TabArchiveAlternant(j, LigDest) = TabAlternant(i, j)
            Next j
        End If
    Next i
   
    With TSArchiveAlternant 'avec la table
        Dim ListCol
        Dim ExtractCol
        Dim TabTransp
       
        ListCol = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) 'liste des colonnes à extraire du tablo
       
        If .ListRows.Count = 1 Then 'si UNE seule ligne dans TSArchiveAlternant (avant le transfert) ==> le transpose d'une ligne vers une colonne ne fonctionne pas ==> on créé manuellement le tabtransp
            ReDim TabTransp(1 To 1, 1 To NbCol)
            For j = LBound(TabArchiveAlternant, 1) To NbCol
                TabTransp(1, j) = TabArchiveAlternant(j, 1)
            Next j
        Else
            TabTransp = Application.WorksheetFunction.Transpose(TabArchiveAlternant) 'on peut directement transposer
        End If
       
        ExtractCol = Application.Index(TabTransp, Evaluate("row(1:" & UBound(TabTransp) & ")"), ListCol) 'on extrait les colonnes
        .DataBodyRange(1, 1).Resize(UBound(ExtractCol, 1), 11) = ExtractCol 'on bascule le résultat
       
       

        If NbNew <> 0 Then 'si on a des nouvelles lignes ==> on les colle en bas de tablo
            LastLine = .ListRows.Add.Index
            .DataBodyRange(LastLine, 1).Resize(UBound(TabNew, 2), UBound(TabNew, 1)) = Application.WorksheetFunction.Transpose(TabNew)
        End If
    End With

    'MsgBox "durée du traitement: " & Timer - start & " secondes"
    Application.ScreenUpdating = True

End Sub
Bonjour Vgendron,
Merci beaucoup pour la réponse, malheureusement cela ne fonctionne pas dans ces conditions:
- Si TbAlternant ne contient pas de données, ça plante
- Si il y a une ligne avec toto dans TbAlternant
- 1ère exécution, ça marche
- 2ème exécution, ça crée 10 lignes supplémentaires avec toto
Désolé et merci de ton aide une nouvelle fois
 
avec un peu d'effort de votre part..
et vu que je m'étais contraint à commenter la quasi totalité du code pour expliquer....


VB:
<With TSAlternant 'avec la TS "TSAlternant"</span>
 If .ListRows.Count = 0 Then exit sub'la table Maj est vide
 
avec un peu d'effort de votre part..
et vu que je m'étais contraint à commenter la quasi totalité du code pour expliquer....


VB:
<With TSAlternant 'avec la TS "TSAlternant"</span>
 If .ListRows.Count = 0 Then exit sub'la table Maj est vide
Désolé, j'ai recopié bêtement et regardé après!!!
Par contre j'ai toujours ce souci
Si il y a une ligne avec toto dans TbAlternant
- 1ère exécution, ça marche
- 2ème exécution, ça crée 10 lignes supplémentaires avec toto
et là je ne trouve pas d'ou cela vient
Merci encore
 
c'est la transposition d'Une ligne qui pose problème

j'ai pas essayé tous les cas de figure
VB:
Option Explicit
Sub Copier_Alternant()

Dim i As Integer
Dim j As Integer
Dim Ind As Integer
Dim NbLig As Integer
Dim Trouvé As Boolean
Dim LigDest As Integer
Dim NomPrenom As String
Dim TSAlternant As ListObject
Dim TSArchiveAlternant As ListObject
Dim TabAlternant() As Variant
Dim TabArchiveAlternant() As Variant
Dim LastLine As Integer
Dim TabNew() As Variant
Dim NbNew As Integer
Dim NbCol As Integer
Application.ScreenUpdating = False

    'Définition des Tables structurées
    Set TSAlternant = Sheets("Import").ListObjects("TbAlternant")
    Set TSArchiveAlternant = Sheets("Archive Alternant").ListObjects("TbArchiveAlternant")
    
    With TSAlternant 'avec la TS "TSAlternant"
        If .ListRows.Count = 0 Then Exit Sub
    'MsgBox TSAlternant.ListColumns(1).DataBodyRange(1)

        TabAlternant = .DataBodyRange.Value2 '.ListColumns(1).DataBodyRange.Resize(, 11).Value 'on met tout (sauf la ligne d'entete) dans un tablo VBA
    End With
    With TSArchiveAlternant 'avec la TS "TSArchiveAlternant"
        If .ListRows.Count = 0 Then 'la table Maj est vide
            'on copie directement le contenu de la commande vers Maj
            .ListRows.Add 'on ajoute une ligne vide
            .DataBodyRange(1, 1).Resize(UBound(TabAlternant, 1), UBound(TabAlternant, 2)) = TabAlternant 'on colle directement le TabAlternant
            'MsgBox "durée du traitement: " & Timer - start & " secondes"
            Application.ScreenUpdating = True
            Exit Sub ' et c'est fini
        Else
            TabArchiveAlternant = Application.WorksheetFunction.Transpose(.DataBodyRange) 'on met tout (sauf la ligne d'entete) dans un tablo VBA
            NbLig = UBound(TabArchiveAlternant, 2) 'on récupère le nombre de lignes
            'MsgBox UBound(TabArchiveAlternant, 1)
        End If
    End With
    
    NbCol = UBound(TabAlternant, 2) 'on récupère le nombre de colonnes
    
    NbNew = 0 'initialisation du nombre de nouvelles lignes
    For i = LBound(TabAlternant, 1) To UBound(TabAlternant, 1) 'pour chaque ligne du tablo
        NomPrenom = TabAlternant(i, 1) 'on récupère la Ref dans la colonne 1
        Trouvé = False 'initialisation
        For Ind = LBound(TabArchiveAlternant, 2) To UBound(TabArchiveAlternant, 2)  'on cherche si la référence est déjà dans le tablo TabArchiveAlternant
            If TabArchiveAlternant(1, Ind) = NomPrenom Then 'on la trouve
                LigDest = Ind 'on note la ligne
                Trouvé = True 'on met à vrai
                Exit For 'on sort de la boucle
            End If
        Next Ind
        
        If Not Trouvé Then 'si pas trouvé alors qu'on a parcouru TOUT le tablo
            NbNew = NbNew + 1 'on ajoute une ligne
            ReDim Preserve TabNew(1 To NbCol, 1 To NbNew) 'on dimensionne le tablo NbNew
            For j = LBound(TabAlternant, 2) To UBound(TabAlternant, 2) 'on rempli avec TOUTE la ligne
                TabNew(j, NbNew) = TabAlternant(i, j)
            Next j
        Else 'on ne remplit que certaines colonnes
            For j = 1 To 11 'on remplit les infos pour les colonnes [NOM - PRENOM]:[COMMENTAIRES] COL 1 à COL 11
                TabArchiveAlternant(j, LigDest) = TabAlternant(i, j)
            Next j
        End If
    Next i
    
    With TSArchiveAlternant 'avec la table
        Dim ListCol
        Dim ExtractCol
        Dim TabTransp
        
        ListCol = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) 'liste des colonnes à extraire du tablo
        
        If .ListRows.Count = 1 Then 'si UNE seule ligne dans TSArchiveAlternant (avant le transfert) ==> le transpose d'une ligne vers une colonne ne fonctionne pas ==> on créé manuellement le tabtransp
            ReDim TabTransp(1 To 1, 1 To NbCol)
            For j = LBound(TabArchiveAlternant, 1) To NbCol
                TabTransp(1, j) = TabArchiveAlternant(j, 1)
            Next j
        Else
            TabTransp = Application.WorksheetFunction.Transpose(TabArchiveAlternant) 'on peut directement transposer
        End If
        
        ExtractCol = Application.Index(TabTransp, Evaluate("row(1:" & UBound(TabTransp) & ")"), ListCol) 'on extrait les colonnes
        .DataBodyRange(1, 1).Resize(1, UBound(ExtractCol, 1)) = ExtractCol 'on bascule le résultat

        If NbNew <> 0 Then 'si on a des nouvelles lignes ==> on les colle en bas de tablo
            LastLine = .ListRows.Add.Index
            .DataBodyRange(LastLine, 1).Resize(UBound(TabNew, 2), UBound(TabNew, 1)) = Application.WorksheetFunction.Transpose(TabNew)
        End If
    End With

    'MsgBox "durée du traitement: " & Timer - start & " secondes"
    Application.ScreenUpdating = True

End Sub
 
c'est la transposition d'Une ligne qui pose problème

j'ai pas essayé tous les cas de figure
VB:
Option Explicit
Sub Copier_Alternant()

Dim i As Integer
Dim j As Integer
Dim Ind As Integer
Dim NbLig As Integer
Dim Trouvé As Boolean
Dim LigDest As Integer
Dim NomPrenom As String
Dim TSAlternant As ListObject
Dim TSArchiveAlternant As ListObject
Dim TabAlternant() As Variant
Dim TabArchiveAlternant() As Variant
Dim LastLine As Integer
Dim TabNew() As Variant
Dim NbNew As Integer
Dim NbCol As Integer
Application.ScreenUpdating = False

    'Définition des Tables structurées
    Set TSAlternant = Sheets("Import").ListObjects("TbAlternant")
    Set TSArchiveAlternant = Sheets("Archive Alternant").ListObjects("TbArchiveAlternant")
   
    With TSAlternant 'avec la TS "TSAlternant"
        If .ListRows.Count = 0 Then Exit Sub
    'MsgBox TSAlternant.ListColumns(1).DataBodyRange(1)

        TabAlternant = .DataBodyRange.Value2 '.ListColumns(1).DataBodyRange.Resize(, 11).Value 'on met tout (sauf la ligne d'entete) dans un tablo VBA
    End With
    With TSArchiveAlternant 'avec la TS "TSArchiveAlternant"
        If .ListRows.Count = 0 Then 'la table Maj est vide
            'on copie directement le contenu de la commande vers Maj
            .ListRows.Add 'on ajoute une ligne vide
            .DataBodyRange(1, 1).Resize(UBound(TabAlternant, 1), UBound(TabAlternant, 2)) = TabAlternant 'on colle directement le TabAlternant
            'MsgBox "durée du traitement: " & Timer - start & " secondes"
            Application.ScreenUpdating = True
            Exit Sub ' et c'est fini
        Else
            TabArchiveAlternant = Application.WorksheetFunction.Transpose(.DataBodyRange) 'on met tout (sauf la ligne d'entete) dans un tablo VBA
            NbLig = UBound(TabArchiveAlternant, 2) 'on récupère le nombre de lignes
            'MsgBox UBound(TabArchiveAlternant, 1)
        End If
    End With
   
    NbCol = UBound(TabAlternant, 2) 'on récupère le nombre de colonnes
   
    NbNew = 0 'initialisation du nombre de nouvelles lignes
    For i = LBound(TabAlternant, 1) To UBound(TabAlternant, 1) 'pour chaque ligne du tablo
        NomPrenom = TabAlternant(i, 1) 'on récupère la Ref dans la colonne 1
        Trouvé = False 'initialisation
        For Ind = LBound(TabArchiveAlternant, 2) To UBound(TabArchiveAlternant, 2)  'on cherche si la référence est déjà dans le tablo TabArchiveAlternant
            If TabArchiveAlternant(1, Ind) = NomPrenom Then 'on la trouve
                LigDest = Ind 'on note la ligne
                Trouvé = True 'on met à vrai
                Exit For 'on sort de la boucle
            End If
        Next Ind
       
        If Not Trouvé Then 'si pas trouvé alors qu'on a parcouru TOUT le tablo
            NbNew = NbNew + 1 'on ajoute une ligne
            ReDim Preserve TabNew(1 To NbCol, 1 To NbNew) 'on dimensionne le tablo NbNew
            For j = LBound(TabAlternant, 2) To UBound(TabAlternant, 2) 'on rempli avec TOUTE la ligne
                TabNew(j, NbNew) = TabAlternant(i, j)
            Next j
        Else 'on ne remplit que certaines colonnes
            For j = 1 To 11 'on remplit les infos pour les colonnes [NOM - PRENOM]:[COMMENTAIRES] COL 1 à COL 11
                TabArchiveAlternant(j, LigDest) = TabAlternant(i, j)
            Next j
        End If
    Next i
   
    With TSArchiveAlternant 'avec la table
        Dim ListCol
        Dim ExtractCol
        Dim TabTransp
       
        ListCol = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) 'liste des colonnes à extraire du tablo
       
        If .ListRows.Count = 1 Then 'si UNE seule ligne dans TSArchiveAlternant (avant le transfert) ==> le transpose d'une ligne vers une colonne ne fonctionne pas ==> on créé manuellement le tabtransp
            ReDim TabTransp(1 To 1, 1 To NbCol)
            For j = LBound(TabArchiveAlternant, 1) To NbCol
                TabTransp(1, j) = TabArchiveAlternant(j, 1)
            Next j
        Else
            TabTransp = Application.WorksheetFunction.Transpose(TabArchiveAlternant) 'on peut directement transposer
        End If
       
        ExtractCol = Application.Index(TabTransp, Evaluate("row(1:" & UBound(TabTransp) & ")"), ListCol) 'on extrait les colonnes
        .DataBodyRange(1, 1).Resize(1, UBound(ExtractCol, 1)) = ExtractCol 'on bascule le résultat

        If NbNew <> 0 Then 'si on a des nouvelles lignes ==> on les colle en bas de tablo
            LastLine = .ListRows.Add.Index
            .DataBodyRange(LastLine, 1).Resize(UBound(TabNew, 2), UBound(TabNew, 1)) = Application.WorksheetFunction.Transpose(TabNew)
        End If
    End With

    'MsgBox "durée du traitement: " & Timer - start & " secondes"
    Application.ScreenUpdating = True

End Sub
c'est parfait comme d'habitude.
Merci 1000 fois pour cette solution, cela faisait 4 heures que j' testais des trucs pour m'en sortir!!!
Bonne journée à vous
Eric
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
5
Affichages
234
  • Question Question
Microsoft 365 Export données
Réponses
4
Affichages
731
Réponses
5
Affichages
617
Retour