Macro qui ne fonctionne plus

MoniqueL

XLDnaute Nouveau
Bonjour à tous et bonne année :)

Un Excell ent m'avait donné une macro qui fonctionnait à merveille. Mais voilà, la macro a du mal digérer la fin de l'année et elle bug.
Je ne sais pas débugger une macro et elle m'est très très utile vue le nombre de ligne à traiter.
Voici ma demande d'origine et la macro.

Merci pour toute aide apportée et
bonne recherche...
 

Pièces jointes

  • macro QUI FONCTIONNait.xlsm
    29.3 KB · Affichages: 39

vgendron

XLDnaute Barbatruc
Bonjour

n'aurais tu pas changé le nom de tes feuilles??
exemple: tablo devrait se référer à la feuille Origine qui contient des datas.. ??

tablo = Sheets("Origine").Range(Cells(5, 1), Cells(derlin, dercol))
exécute ta macro en mode pas à pas (Touche F8), tu devrais identifier facilement la ou ca coince..
 

vgendron

XLDnaute Barbatruc
genre.. ca te donnerait ceci

VB:
Sub report()
Sheets("Feuil2").Range("A2:F" & Rows.Count).ClearContents
With Sheets("Origine")
    dercol = .Cells(5, Columns.Count).End(xlToLeft).Column
    derlin = .Cells(Rows.Count, 1).End(xlUp).Row
    tablo = .Range(Cells(5, 1), Cells(derlin, dercol))
    For n = LBound(tablo, 1) + 1 To UBound(tablo, 1)
        For m = 4 To UBound(tablo, 2)
            If tablo(n, m) > 0 Then
                With Sheets("Feuil2")
                    derl = .Cells(Rows.Count, 1).End(xlUp).Row + 1
                    .Cells(derl, 1) = tablo(n, 1)
                    .Cells(derl, 2) = tablo(n, 2)
                    .Cells(derl, 3) = tablo(n, 3)
                    .Cells(derl, 4) = tablo(1, m)
                    .Cells(derl, 6) = tablo(n, m)
                End With
            End If
            If tablo(n, m) < 0 Then
                With Sheets("Feuil2")
                    derl = .Cells(Rows.Count, 1).End(xlUp).Row + 1
                    .Cells(derl, 1) = tablo(n, 1)
                    .Cells(derl, 2) = tablo(n, 2)
                    .Cells(derl, 3) = tablo(n, 3)
                    .Cells(derl, 4) = tablo(1, m)
                    .Cells(derl, 5) = -tablo(n, m)
                End With
            End If
        Next m
    Next n
End With
Sheets("Feuil2").Select
End Sub
 

Discussions similaires

E
Réponses
4
Affichages
665
enzoreno
E

Statistiques des forums

Discussions
312 294
Messages
2 086 881
Membres
103 404
dernier inscrit
sultan87