OVH Cloud OVH Cloud

Obtenir un clignotement

3 réponses
Avatar
Franck
Bonjour,

Je voudrais trouver un moyen pour attirer l'attention de=20
l'utilisateur sur une cellule, en faisant apparaitre, par=20
exemple, un ovale rouge clignotant autour de la cellule,=20
pendant quelques secondes.

Quelqu'un a t-il une id=E9e ?

Merci

FB

3 réponses

Avatar
nicolas
Voici une fonction vba permttant de faire clignoter une
cellule. Il ne te reste plus qu'à déterminer le moment où
tu souhaites activer cette fonction:

Sub Flash()
Worksheets(1).Cells(1, 1).Activate
If ActiveCell.Interior.ColorIndex < 0 Then
ActiveCell.Interior.ColorIndex = 1 'fond noir
ActiveCell.Font.ColorIndex = 2 'texte en blanc
Else
ActiveCell.Interior.ColorIndex =
(ActiveCell.Interior.ColorIndex + 1) Mod 2
ActiveCell.Font.Color = 1
End If
Application.OnTime Now + TimeValue("00:00:01"), "Flash"
End Sub
Avatar
Franck
J'obtiens une erreur sur la ligne

Application.OnTime Now + TimeValue("00:00:01"), "Flash"

avec comme message 'Impossible de trouver la macro Flash'


-----Message d'origine-----
Voici une fonction vba permttant de faire clignoter une
cellule. Il ne te reste plus qu'à déterminer le moment où
tu souhaites activer cette fonction:

Sub Flash()
Worksheets(1).Cells(1, 1).Activate
If ActiveCell.Interior.ColorIndex < 0 Then
ActiveCell.Interior.ColorIndex = 1 'fond noir
ActiveCell.Font.ColorIndex = 2 'texte en blanc
Else
ActiveCell.Interior.ColorIndex =
(ActiveCell.Interior.ColorIndex + 1) Mod 2
ActiveCell.Font.Color = 1
End If
Application.OnTime Now + TimeValue("00:00:01"), "Flash"
End Sub

.



Avatar
nicolas
Voici une autre macro, moins jolie mais qui devrait mieux
fonctionner...
L'exemple est tiré du site: http://www.excel-
downloads.com/html/French/fichiers/programmation-
nb_downloads-1.htm
C'est la leçon numéro 3

Sub Action3()
ActiveSheet.Shapes("fleche").Visible = True
With range("d5").Select
Selection.Font.ColorIndex = 3
Attente (2000)
Selection.Font.ColorIndex = 2
Attente (2000)
Selection.Font.ColorIndex = 3
Attente (2000)
Selection.Font.ColorIndex = 2
Attente (2000)
Selection.Font.ColorIndex = 3
Attente (2000)
Selection.Font.ColorIndex = 2
Attente (2000)
Selection.Font.ColorIndex = 3
Attente (2000)
Selection.Font.ColorIndex = 2
Attente (2000)
Selection.Font.ColorIndex = 3
Attente (2000)
Selection.Font.ColorIndex = 2
Attente (2000)
Selection.Font.ColorIndex = 3
Attente (2000)
Selection.Font.ColorIndex = 2
Attente (2000)
Selection.Font.ColorIndex = 3
Attente (2000)
Selection.Font.ColorIndex = 2
Attente (2000)
Selection.Font.ColorIndex = 2
Attente (2000)
Selection.Font.ColorIndex = 2
Attente (2000)
ActiveSheet.Shapes("fleche").Visible = False
End With
End Sub
Sub Attente(milisecond As Integer)
Dim Start, PauseTime
PauseTime = milisecond / 7200
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
End Sub