Carlosjunior
New Member
- Joined
- Jun 7, 2023
- Messages
- 7
- Office Version
- 2021
- Platform
- Windows
WORKSHEETS
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 13 Then
If Range("M10").Value > 2 Then
Range("K9").Value = 0
Call PiscarM9
Exit Sub
End If
End If
End Sub
'------------------------------------------------------------------------------
Sub PiscarM9()
If Range("K9").Value = 0 Then
Range("M10").Interior.ColorIndex = 0
Application.Wait Now + TimeValue("0:00:01")
Range("M10").Borders.ColorIndex = 45
ElseIf Range("K9").Value = 1 Then
Range("M10").Borders.ColorIndex = 0
Exit Sub
End If
If Range("M10").Value < 2 Then
Range("M10").Borders.ColorIndex = 0
Exit Sub
End If
Call PiscarM9_Reiniciar
End Sub
'------------------------------------------------------------------------------
Sub PiscarM9_Reiniciar()
Call Application.OnTime(Now + TimeValue("00:00:01"), "PiscarM9")
End Sub
'------------------------------------------------------------------------------
Sub PiscarM9_Parar()
Resposta = MsgBox("Deseja realmente cancelar o alarme?", vbOKCancel)
If Resposta = vbOK Then
Range("K9").Value = 1
End If
End Sub
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Module
Sub PiscarM9()
Dim Celula As Range
Set Celula = Range("M10")
Do While Celula > 2
'celula.Interior.ColorIndex=45
Celula.Borders.ColorIndex = 45
Application.Wait Now + TimeValue("0:00:01")
'celula.Interior.ColorIndex=0
Celula.Borders.ColorIndex = 0
Application.Wait Now + TimeValue("0:00:01")
DoEvents
Loop
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 13 Then
If Range("M10").Value > 2 Then
Range("K9").Value = 0
Call PiscarM9
Exit Sub
End If
End If
End Sub
'------------------------------------------------------------------------------
Sub PiscarM9()
If Range("K9").Value = 0 Then
Range("M10").Interior.ColorIndex = 0
Application.Wait Now + TimeValue("0:00:01")
Range("M10").Borders.ColorIndex = 45
ElseIf Range("K9").Value = 1 Then
Range("M10").Borders.ColorIndex = 0
Exit Sub
End If
If Range("M10").Value < 2 Then
Range("M10").Borders.ColorIndex = 0
Exit Sub
End If
Call PiscarM9_Reiniciar
End Sub
'------------------------------------------------------------------------------
Sub PiscarM9_Reiniciar()
Call Application.OnTime(Now + TimeValue("00:00:01"), "PiscarM9")
End Sub
'------------------------------------------------------------------------------
Sub PiscarM9_Parar()
Resposta = MsgBox("Deseja realmente cancelar o alarme?", vbOKCancel)
If Resposta = vbOK Then
Range("K9").Value = 1
End If
End Sub
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Module
Sub PiscarM9()
Dim Celula As Range
Set Celula = Range("M10")
Do While Celula > 2
'celula.Interior.ColorIndex=45
Celula.Borders.ColorIndex = 45
Application.Wait Now + TimeValue("0:00:01")
'celula.Interior.ColorIndex=0
Celula.Borders.ColorIndex = 0
Application.Wait Now + TimeValue("0:00:01")
DoEvents
Loop
End Sub