OVH Cloud OVH Cloud

Clignotement conditionnel

1 réponse
Avatar
Peanut
Peut-on faire clignoter une cellule sous condition, et comment ? Merci

1 réponse

Avatar
AV
Pour que A1 clignote si sa valeur et égale à 10 :

Dans un module ordinaire :
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Dans le module de la feuille :
Private adres, selec
Private Sub Worksheet_Change(ByVal zz As Range)
If zz.Address <> "$A$1" Or zz.Value <> 10 Then Exit Sub
adres = zz.Address
Clignote
End Sub

Private Sub Worksheet_SelectionChange(ByVal zz As Range)
selec = zz
End Sub

Sub Clignote()'av
Dim i As Integer
With Sheets("Feuil2")
mem1 = Range(adres).Font.ColorIndex
mem2 = Range(adres).Font.Size
mem3 = Range(adres).Font.Bold
For i = 0 To 20
If Range(adres).Font.ColorIndex = 3 Then
Range(adres).Font.ColorIndex = 2
Else: Range(adres).Font.ColorIndex = 3
End If
Range(adres).Font.Size = mem2 + 6
Range(adres).Font.Bold = True
Sleep (50)
DoEvents
Next i
With Range(adres)
.Font.Size = mem2
.Font.ColorIndex = mem1
.Font.Bold = mem3
End With
End With
End Sub

AV