make worksheet tab blink?

D

Daniel M

Is there a way to make the tab on an excel worksheet blink? I have a
multi-tab workbook that is opened every day. I want to blink a specific cell
if data exists in that tabs column A but not B.

Basically it's a task in column A and a completed in column B. I want to
blink the tab if the task is not completed so the person opening the workbook
will notice it and go to the tab. thanks.
 
P

Peter T

In theory it'd be possible to set up a timer to change the tab colour, at
least in Excel 2003 or later. However blinking cells, tabs etc are
considered bad practice with good reason. There are other ways to warn user,
try this in a new workbook, copy the code into ThisWorkbook and normal
modules as directed (post back if you are not sure what they are).

' code in ThisWorkbook

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If TaskNotComplete("close") = True Then
Cancel = True
End If
End Sub

Private Sub Workbook_Open()
TaskNotComplete "open"
End Sub

''' end code in ThisWorkbook


' code in a normal module

Function TaskNotComplete(sEvent As String) As Boolean
Dim sMsg As String
Dim result As VbMsgBoxResult
Dim mbs As VbMsgBoxStyle

If Worksheets("Sheet3").Range("C3") = "" Then
Worksheets("Sheet3").Activate
Range("C3").Select

Select Case sEvent
Case "close"
sMsg = "Do you want to complete Sheet3!C3 before closing ?"
mbs = vbYesNo Or vbQuestion

Case Else
sMsg = "Sheet3!C3 was not completed last time"
mbs = vbOKOnly Or vbInformation
End Select
result = MsgBox(sMsg, mbs, "Task not completed")
If result = vbYes Then
TaskNotComplete = True
End If

End If

End Function

Save the workbook
Attempt to close the workbook, answer Yes at the prompt
Attempt to close the workbook again and answer No
Reopen the workbook

Regards,
Peter T
 

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

Top