Private Sub CommandButton2_Click()
Dim PauseTime, Start, Finish
Dim x As Integer
Dim y As Integer
For I = 0 To 5
y = I
Select Case y
Case 0
x = 2
Case 1
x = 3
Case 2
x = 2
Case 3
x = 3
Case 4
x = 2
Case 5
x = 3
End Select
Cells(4, 10) = "ATTENZIONE"
Cells(4, 10).Interior.ColorIndex = x
PauseTime = 0.5
Start = Timer
Do While Timer < Start + PauseTime
'DoEvents 'si consente di passare il controllo ad altri processi.(altrimenti il ciclo bloccherebbe altri eventi)
Loop
Finish = Timer ' Imposta l'ora di fine della pausa.
Next
Cells(4, 10).Interior.ColorIndex = 0
Cells(4, 10) = ""
End Sub |