XL 2013 Copier coller avec conditions

tit32600

XLDnaute Nouveau
bonjour a tous

Je reviens vers vous,

dans mon fichier joint, je souhaiterais inscrire avec une macro vba dans ma feuille "Stock critique", la reference des articles de ma feuille "Stock" dont la valeur "Stock" est égal ou inférieure au stock critique

mais je suis pas excellent en vba, je l'avoue

merci encore

tit32600
 

Pièces jointes

  • Exemple.xlsm
    25.1 KB · Affichages: 13
Solution
Bonjour Tit,
Un exemple en PJ avec :
VB:
Sub Worksheet_Activate()
    Application.ScreenUpdating = False
    Range("A4:D1000").ClearContents
    IndexW = 4
    DL = Sheets("Stock").Range("A65500").End(xlUp).Row
    With Sheets("Stock")
        For i = 3 To DL
            If .Cells(i, "F") <= .Cells(i, "G") Then
                Cells(IndexW, "A") = .Cells(i, "D")     ' Désignation
                Cells(IndexW, "B") = .Cells(i, "C")     ' N° article
                Cells(IndexW, "C") = .Cells(i, "J")     ' Emplacement
                Cells(IndexW, "D") = .Cells(i, "F")     ' Stock
                IndexW = IndexW + 1
            End If
        Next i
    End With
End Sub
La macro s'exécute lorsqu'on sélectionne la feuille Stock...

sylvanu

XLDnaute Barbatruc
Supporter XLD
Bonjour Tit,
Un exemple en PJ avec :
VB:
Sub Worksheet_Activate()
    Application.ScreenUpdating = False
    Range("A4:D1000").ClearContents
    IndexW = 4
    DL = Sheets("Stock").Range("A65500").End(xlUp).Row
    With Sheets("Stock")
        For i = 3 To DL
            If .Cells(i, "F") <= .Cells(i, "G") Then
                Cells(IndexW, "A") = .Cells(i, "D")     ' Désignation
                Cells(IndexW, "B") = .Cells(i, "C")     ' N° article
                Cells(IndexW, "C") = .Cells(i, "J")     ' Emplacement
                Cells(IndexW, "D") = .Cells(i, "F")     ' Stock
                IndexW = IndexW + 1
            End If
        Next i
    End With
End Sub
La macro s'exécute lorsqu'on sélectionne la feuille Stock critique.
 

Pièces jointes

  • Exemple (8).xlsm
    26 KB · Affichages: 5

tit32600

XLDnaute Nouveau
Bonjour Tit,
Un exemple en PJ avec :
VB:
Sub Worksheet_Activate()
    Application.ScreenUpdating = False
    Range("A4:D1000").ClearContents
    IndexW = 4
    DL = Sheets("Stock").Range("A65500").End(xlUp).Row
    With Sheets("Stock")
        For i = 3 To DL
            If .Cells(i, "F") <= .Cells(i, "G") Then
                Cells(IndexW, "A") = .Cells(i, "D")     ' Désignation
                Cells(IndexW, "B") = .Cells(i, "C")     ' N° article
                Cells(IndexW, "C") = .Cells(i, "J")     ' Emplacement
                Cells(IndexW, "D") = .Cells(i, "F")     ' Stock
                IndexW = IndexW + 1
            End If
        Next i
    End With
End Sub
La macro s'exécute lorsqu'on sélectionne la feuille Stock critique.
salut sylvanu,

merci encore, cela me va tout a fait, cool

tit32600
 

Discussions similaires

Statistiques des forums

Discussions
312 094
Messages
2 085 231
Membres
102 828
dernier inscrit
cdupire