Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

modif sur un chrono

raym1313

XLDnaute Occasionnel
bonjour a tous

j ai une macro qui affiche un chrono
cette macro fonctionne parfaitement ( grace a vous d'ailleurs )

je souhaiterai qu'au bout de 2h - arret du chrono sans qu'il se remette a zero
et qu'une msgbox m'affiche un message
je vous ai joint un petit fichier

merci pour votre aide

amicalement
raymond
 

Pièces jointes

  • modif chrono.xls
    27 KB · Affichages: 52

skoobi

XLDnaute Barbatruc
Re : modif sur un chrono

Bonjour raym1313,

voici l'ensemble du module modifié (en bleue les ajouts):

Code:
[B][COLOR=blue]Public début[/COLOR][/B]
Public prochainchrono
Public chrono
Sub majchrono()
temp = chrono / 3600
Sheets("feuil1").[b5] = Format(temp / 24, "hh:mm:ss")
chrono = chrono + 1
prochainchrono = Now + TimeValue("00:00:1")
[B][COLOR=blue]If prochainchrono = début + TimeValue("02:00:00") Then[/COLOR][/B]
[B][COLOR=blue]  MsgBox "fin du temps réglementaire."[/COLOR][/B]
[B][COLOR=blue]  Exit Sub[/COLOR][/B]
[B][COLOR=blue]End If[/COLOR][/B]
Application.OnTime prochainchrono, "majchrono"
End Sub
Sub auto_close()
On Error Resume Next
Application.OnTime prochainchrono, procedure:="majchrono", schedule:=False
End Sub
Sub demarre()
If Sheets("feuil1").[b5].Value > 0 Then
Sheets("feuil1").[b5].Value = 0
Exit Sub
End If
[B][COLOR=blue]début = Now[/COLOR][/B]
chrono = 0
majchrono
End Sub
 

raym1313

XLDnaute Occasionnel
Re : modif sur un chrono

re bonjour

et merci beaucoup cela fonctionne parfaitement


je vais abuser de ta gentillesse je souhaiterai ameliorer cette macro
en ajoutant lors du message box un signal ou plusieurs beep

et c'est le clic sur le ok qui arreterait ce signal

qu'en penses tu est ce possible


amicalement
raymond
 

JCGL

XLDnaute Barbatruc
Re : modif sur un chrono

Bonjour à tous,
Salut Skooby,
Salut Raymond,

Peux-tu essayer avec ce code de Skooky, sonorisé.... arf

Code:
Public début
Public prochainchrono
Public chrono
Sub majchrono()
[COLOR=blue][B]Dim x%[/B][/COLOR]
temp = chrono / 3600
Sheets("feuil1").[b5] = Format(temp / 24, "hh:mm:ss")
chrono = chrono + 1
prochainchrono = Now + TimeValue("00:00:1")
If prochainchrono = début + TimeValue("02:00:00") Then
 
MsgBox "fin du temps réglementaire.", [B][COLOR=blue]vbCritical[/COLOR][/B]
[B][COLOR=blue]For x = 1 To 5000[/COLOR][/B]
[B][COLOR=blue]Beep[/COLOR][/B]
[B][COLOR=blue]Next[/COLOR][/B]
Exit Sub
End If
Application.OnTime prochainchrono, "majchrono"
End Sub
Sub auto_close()
On Error Resume Next
Application.OnTime prochainchrono, procedure:="majchrono", schedule:=False
End Sub
Sub demarre()
If Sheets("feuil1").[b5].Value > 0 Then
Sheets("feuil1").[b5].Value = 0
Exit Sub
End If
début = Now
chrono = 0
majchrono
End Sub

A+ mes amis
A+ à tous
 

skoobi

XLDnaute Barbatruc
Re : modif sur un chrono

Re,
salut JC ,

ce serait pas mieux de mettre la boucle avant le message?
Car sinon le son ce produira uniquement après avoir cliqué sur le "bouton" ok non?
 

raym1313

XLDnaute Occasionnel
Re : modif sur un chrono

re bonsoir

j ai pris le code de JC

Public début
Public prochainchrono
Public chrono
Sub majchrono()
Dim x%
temp = chrono / 3600
Sheets("feuil1").[b5] = Format(temp / 24, "hh:mm:ss")
chrono = chrono + 1
prochainchrono = Now + TimeValue("00:00:1")
If prochainchrono = début + TimeValue("02:00:00") Then

MsgBox "fin du temps réglementaire.", vbCritical
For x = 1 To 5000
Beep
Next
Exit Sub
End If
Application.OnTime prochainchrono, "majchrono"
End Sub
Sub auto_close()
On Error Resume Next
Application.OnTime prochainchrono, procedure:="majchrono", schedule:=False
End Sub
Sub demarre()
If Sheets("feuil1").[b5].Value > 0 Then
Sheets("feuil1").[b5].Value = 0
Exit Sub
End If
début = Now
chrono = 0
majchrono
End Sub

quel modification dois je apporter
tu me propose de faire une modif avant le msg
comment ?

merci de me corriger le code

amicalement
raymond
 

roro69

XLDnaute Impliqué
Re : modif sur un chrono

Bonsoir
Je me permet de te répondre car je vois que jcgl,et skoobi sont hors ligne;comme skoobi la marqué la haut il faut mettre la boucle juste avant le message.
Bonne soirée
Et surtout un merci à sko0bi Et JCGL
 

roro69

XLDnaute Impliqué
Re : modif sur un chrono

REbonsoir RAYMOND si comme tu me le dis çà ne marche toujours pas essaye ce bout de code:
 

Discussions similaires

Réponses
6
Affichages
307
Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…