XL 2016 Cellule clignotante

Peponne31

XLDnaute Nouveau
Bonsoir,

J'ai trouvé cette formule sur le net et je voudrai la modifier pour la faire clignoter une vingtaine de fois,

Public Sub Clignotement()
With ThisWorkbook.Styles("Flashing")
If .Font.ColorIndex = 7 Then
.Font.ColorIndex = 46
.Interior.ColorIndex = 3
Else
.Font.ColorIndex = 7
.Interior.ColorIndex = 4
End If
End With



nextTime = Now() + TimeValue("00:00:01")
Application.OnTime nextTime, "Clignotement"

End Sub

pourriez-vous me dire comment la modifier ?
Cordialement
 

Dranreb

XLDnaute Barbatruc
Bonsoir.
Le mieux c'est d'indiquer combien de fois vous voulez qu'il clignote :
VB:
Public Sub Clignotement(Optional ByVal N As Integer = 20)
   Static Tps As Date, Cmde As String
   If N > 0 Then
      With ThisWorkbook.Styles("Flashing")
         .Font.ColorIndex = 7 + 46 - .Font.ColorIndex
         .Interior.ColorIndex = 4 + 3 - .Interior.ColorIndex
         End With
   ElseIf Tps <> 0 Then
      Application.OnTime Tps, Cmde, Schedule:=False
      End If
   If N > 1 Then
      Tps = Now() + TimeValue("00:00:01")
      Cmde = "'Clignotement " & N - 1 & "'"
      Application.OnTime Tps, Cmde
   Else: Tps = 0: End If
   End Sub
Code:
Sub Test()
   Clignotement 6
   End Sub
 
Dernière édition:

Discussions similaires