Code help

M

MAX

Will you please tell me what I have wrong with this code?

In Workbook:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
stopFlashing
End Sub

Private Sub Workbook_Open()
startFlashing
End Sub

In Module:
Option Explicit
Dim nextSecond

Sub startFlashing()
flashCell
End Sub

Sub stopFlashing()
On Error Resume Next
Application.OnTime nextSecond, "flashCell", , False
End Sub

Sub flashCell()
nextSecond = Now + TimeValue("00:00:01")
Application.OnTime nextSecond, "flashCell"


If Range("B1").Interior.ColorIndex = 36 Then
Sheet1.Range("B1").Interior.ColorIndex = 41
Sheet1.Range("B1").Value = "Light Blue"

Sheet2.Range("B1").Interior.ColorIndex = 41
Sheet2.Range("B1").Value = "Light Blue"

Sheet3.Range("B1").Interior.ColorIndex = 41
Sheet3.Range("B1").Value = "Light Blue"

ElseIf Range("B1").Interior.ColorIndex = 41 Then
Sheet1.Range("B1").Interior.ColorIndex = 36
Sheet1.Range("B1").Value = "Light Yellow"

Sheet2.Range("B1").Interior.ColorIndex = 36
Sheet2.Range("B1").Value = "Light Yellow"

Sheet3.Range("B1").Interior.ColorIndex = 36
Sheet3.Range("B1").Value = "Light Yellow"
End If
End Sub
 
F

FSt1

hi
what is it doing/not doing?????

i suspect that you haven't defined nextsecond properly.

Regards
FSt1
 
F

FSt1

ok. that is what you want. what is the code doing or not doing that is the
problem?

regards
FSt1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Cells flashing 2
Adding code 5
Adding code 2
Code error 5
Arrange code 3
2 codes in one sheet 5
Compile error 7
Code arrangement 3

Top