XL 2019 remplacement de macro

valouf

XLDnaute Junior
Bonjour je voudrais une nouvelle macro pour faire une boucle ci joint fichier merci d'avance
 

Pièces jointes

  • macro pour faire une boucle.xlsm
    16.6 KB · Affichages: 5

sylvanu

XLDnaute Barbatruc
Supporter XLD
Bonsoir Valouf,
En trichant, une possibilité :
VB:
Sub DecompteMN()
N = 1           ' N vaut 1
While N > 0     ' Tant que N positif on boucle, et donc on boucle à l'infini puisque N est toujours positif
    With Sheets("essai")
        If IsNumeric(.[B9]) Then
            If .[B9] > 0 Then
                .[B12] = .[B9]
                Do While .[B12] > 0
                    Application.Wait Now + TimeValue("0:0:1")
                    .[B12] = .[B12] - 1
                Loop
            End If
        End If
        Call arret("Vous êtes arrivé")
        .[B12] = .[B9]
    End With
Wend
End Sub
Sub arret(vocal)
    Application.Speech.Speak vocal, 1
End Sub
On fixe N à 1, puis on boucle tant que N est positif.
Donc à l'infini puisque N est toujours positif.
 

Pièces jointes

  • macro pour faire une boucle.xlsm
    15.7 KB · Affichages: 0

valouf

XLDnaute Junior
Bonsoir Valouf,
En trichant, une possibilité :
VB:
Sub DecompteMN()
N = 1           ' N vaut 1
While N > 0     ' Tant que N positif on boucle, et donc on boucle à l'infini puisque N est toujours positif
    With Sheets("essai")
        If IsNumeric(.[B9]) Then
            If .[B9] > 0 Then
                .[B12] = .[B9]
                Do While .[B12] > 0
                    Application.Wait Now + TimeValue("0:0:1")
                    .[B12] = .[B12] - 1
                Loop
            End If
        End If
        Call arret("Vous êtes arrivé")
        .[B12] = .[B9]
    End With
Wend
End Sub
Sub arret(vocal)
    Application.Speech.Speak vocal, 1
End Sub
On fixe N à 1, puis on boucle tant que N est positif.
Donc à l'infini puisque N est toujours positif.
 

Discussions similaires

Statistiques des forums

Discussions
312 213
Messages
2 086 302
Membres
103 174
dernier inscrit
OBUTT