
Sub Flash()
Dim Nexttime
Nexttime = Now + TimeValue("00:00:01")
With ActiveWorkbook.Worksheets("Foglio1").Range("A1,A3,A5,A9").Interior
If .ColorIndex = 2 Then .ColorIndex = 7 Else .ColorIndex = 2
End With
Application.OnTime Nexttime, "Flash"
End Sub
|
Sub Commandbutton1_click()
Dim Nexttime
Nexttime = Now + TimeValue("00:00:01")
With ActiveWorkbook.Worksheets("Foglio1").Range("A1,A3,A5").Interior
If .ColorIndex = 2 Then .ColorIndex = 7 Else .ColorIndex = 2
End With
With ActiveWorkbook.Worksheets("Foglio1").Range("A9").Interior
If .ColorIndex = 2 Then .ColorIndex = 4 Else .ColorIndex = 2
End With
With ActiveWorkbook.Worksheets("Foglio1").Range("A12,a15").Interior
If .ColorIndex = 2 Then .ColorIndex = 4 Else .ColorIndex = 2
End With
Application.OnTime Nexttime, "Commandbutton1_click"
End Sub
|
Private NextFlash As Double
Sub StartFlashing()
If Range("A2,A4").Interior.ColorIndex > 0 Then
Range("A2,A4").Interior.ColorIndex = xlColorIndexNone
Else
Range("A2,A4").Interior.ColorIndex = 8
End If
NextFlash = Now + TimeSerial(0, 0, 1)
Application.OnTime NextFlash, "ThisWorkbook.StartFlashing", , True
End Sub
Sub StopFlashing()
Range("A2,A4").Interior.ColorIndex = xlColorIndexNone
Application.OnTime NextFlash, "ThisWorkbook.StartFlashing", , False
End Sub
Private Sub Workbook_Open()
ThisWorkbook.StartFlashing
End Sub
Private Sub Workbook_Close()
ThisWorkbook.StopFlashing
End Sub
|
Sub StartFlashing()
If ActiveWorkBook.Sheets("Foglio1").Range("A2,A4").Interior.ColorIndex > 0 Then |
Private NextFlash As Double
Sub StartFlashing()
If ActiveWorkbook.Sheets("Foglio1").Range("A2,A4").Interior.ColorIndex > 0 Then
ActiveWorkbook.Sheets("Foglio1").Range("A2,A4").Interior.ColorIndex = xlColorIndexNone
Else
ActiveWorkbook.Sheets("Foglio1").Range("A2,A4").Interior.ColorIndex = 8
End If
NextFlash = Now + TimeSerial(0, 0, 1)
Application.OnTime NextFlash, "ThisWorkbook.StartFlashing", , True
End Sub
Sub StopFlashing()
ActiveWorkbook.Sheets("Foglio1").Range("A2,A4").Interior.ColorIndex = 8 'xlColorIndexNone
Application.OnTime NextFlash, "ThisWorkbook.StartFlashing", , False
End Sub
Private Sub Workbook_Open()
ThisWorkbook.StartFlashing
End Sub
Private Sub Workbook_Close()
ThisWorkbook.StopFlashing
End Sub
|
Option Explicit
Sub start_timer()
Application.OnTime EarliestTime:=Now + TimeSerial(0, 0, 1), Procedure:="blink", Schedule:=True 'ogni secondo parte "blink"
End Sub
Sub blink()
If LCase(Left(ActiveWorkbook.Name, 5)) <> "celle" Then Debug.Print "exiting": Exit Sub
With Sheets("Foglio1").[A2,A4].Interior
If .ColorIndex = 8 Then
.ColorIndex = xlColorIndexNone
Else
.ColorIndex = 8
End If
End With
start_timer
End Sub
Sub stop_timer()
On Error Resume Next
Application.OnTime EarliestTime:=Now + TimeSerial(0, 0, 1), Procedure:="blink", Schedule:=False 'stop procedura "blink"
Sheets("Foglio1").[A2,A4].Interior.ColorIndex = xlColorIndexNone
End Sub
|
'in thisworkbook del foglio con le celle lampeggianti
Private Sub Workbook_Activate()
start_timer
End Sub
Private Sub Workbook_Deactivate()
stop_timer
End Sub
|
Private NextFlash As Double
Sub StartFlashing()
If ActiveWorkbook.Sheets("Foglioprova").Range("A2,A4").Interior.ColorIndex > 0 Then
ActiveWorkbook.Sheets("Foglioprova").Range("A2,A4").Interior.ColorIndex = xlColorIndexNone
Else
ActiveWorkbook.Sheets("Foglioprova").Range("A2,A4").Interior.ColorIndex = 8
End If
NextFlash = Now + TimeSerial(0, 0, 1)
Application.OnTime NextFlash, "ThisWorkbook.StartFlashing", , True
End Sub
Sub StopFlashing()
ActiveWorkbook.Sheets("Foglioprova").Range("A2,A4").Interior.ColorIndex = 8 'xlColorIndexNone
Application.OnTime NextFlash, "ThisWorkbook.StartFlashing", , False
End Sub
Private Sub Workbook_Activate()
StartFlashing
End Sub
Private Sub Workbook_Deactivate()
StopFlashing
End Sub
|
