Answer the question
In order to leave comments, you need to log in
Svetlofor in excel, how to make a delay?
I'm making a traffic light in excel, and I don't know how to correctly make a delay, such as when I turn it on so that first it goes red, then it waits for yellow, and then it waits for etc.
Sub Prodleva()
Dim Delka As Single
Delka = 1.3
Dim bunka As Range
Set bunka = ActiveCell
Dim Kon As Single
Kon = timer + Delka
bunka(1, 1).Interior.ColorIndex = 9
bunka(2, 1).Interior.ColorIndex = 44
bunka(3, 1).Interior.ColorIndex = 10
Do While timer < Kon
If Cells.FillUp Then
bunka(1, 1).Interior.ColorIndex = 3
If Cells.FillUp Then
bunka(2, 1).Interior.ColorIndex = 6
If Cells.FillUp Then
bunka(3, 1).Interior.ColorIndex = 4
bunka(1, 1).Interior.ColorIndex = 9
bunka(2, 1).Interior.ColorIndex = 44
bunka(3, 1).Interior.ColorIndex = 10
If Cells.FillUp Then
bunka(3, 1).Interior.ColorIndex = 4
If Cells.FillUp Then
bunka(2, 1).Interior.ColorIndex = 6
If Cells.FillUp Then
bunka(1, 1).Interior.ColorIndex = 3
If Cells.FillUp Then
bunka(1, 1).Interior.ColorIndex = 9
bunka(2, 1).Interior.ColorIndex = 44
bunka(3, 1).Interior.ColorIndex = 10
End If
End If
End If
End If
End If
End If
End If
Loop
End Sub
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question