The Flashing Cell When Certain Condition Is Met
In our example, if the value of cell A1 is greater than 5, this cell starts to flash. The flashing event is realized by changing the background color and font color of the cell at a particular time (firstly red ,then white color) .
We added a module to ensure the cell flash and paste the following codes into the module:
Sub auto_open()
If Range("A1").Value > 5 Then
Call basla
End If
End Sub
Sub auto_close()
dur = True
End Sub
Sub basla()
If dur = True Then Exit Sub
If Range("A1").Value <= 5 Then
Exit Sub
End If
If Format(Now, "ss") Mod 2 = 0 Then
Range("A1").Interior.Color = vbRed
Range("A1").Font.Color = vbWhite
Range("A1").Font.Size = 11
Range("A1").Font.Bold = True
Else
Range("A1").Interior.ColorIndex = xlNone
Range("A1").Font.Color = vbBlack
Range("A1").Font.Bold = False
End If
Call saat
End Sub
Sub saat()
Application.OnTime Now + TimeValue("00:00:01"), "basla"
End Sub
If Range("A1").Value > 5 Then
Call basla
End If
End Sub
Sub auto_close()
dur = True
End Sub
Sub basla()
If dur = True Then Exit Sub
If Range("A1").Value <= 5 Then
Exit Sub
End If
If Format(Now, "ss") Mod 2 = 0 Then
Range("A1").Interior.Color = vbRed
Range("A1").Font.Color = vbWhite
Range("A1").Font.Size = 11
Range("A1").Font.Bold = True
Else
Range("A1").Interior.ColorIndex = xlNone
Range("A1").Font.Color = vbBlack
Range("A1").Font.Bold = False
End If
Call saat
End Sub
Sub saat()
Application.OnTime Now + TimeValue("00:00:01"), "basla"
End Sub
We enabled the macro to start automatically with VBA auto_open method.
Sub auto_open()
If Range("A1").Value > 5 Then
Call basla
End If
End Sub
If Range("A1").Value > 5 Then
Call basla
End If
End Sub
No comments:
Post a Comment