How to make two or more cells blink in VBA Excel . I have this code below and I'm not getting it, I ask for help

Carlosjunior

New Member
Joined
Jun 7, 2023
Messages
7
Office Version
  1. 2021
Platform
  1. 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
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
VBA Code:
Option Explicit

Public NextTime As Date

Sub FlashI30()
    NextTime = Now + TimeValue("00:00:01")
    With ActiveSheet.Range("D3")
        If .Value = "" Then
            With .Interior
                If .ColorIndex = xlNone Then .ColorIndex = 4 Else .ColorIndex = xlNone
            End With
            Application.OnTime NextTime, "FlashI30"
        Else
            .Interior.ColorIndex = xlNone
        End If
    End With
End Sub

Sub StopIt()
    Application.OnTime NextTime, "FlashI30", schedule:=False
    ActiveSheet.Range("I30").Interior.ColorIndex = xlNone
End Sub

You can use two CommandButtons ... one to start the process and a second button to StopIt.
 
Upvote 0

Forum statistics

Threads
1,223,901
Messages
6,175,277
Members
452,629
Latest member
SahilPolekar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top