Thank you Chip. I know we are almost there.
But when I add that code to "thisworkbook", the lines....
Application.OnTime RunWhen......
turn red on the macors Sub StartBlink() and Sub StopBlink()
What am I missing? Thank you for sharing.
Here is how it looks at present:
Module7:
Public RunWhen As Double
Sub StartBlink()
With ThisWorkbook.Worksheets("work").Range("g6").Font
If .ColorIndex = 3 Then ' Red Text
.ColorIndex = 2 ' White Text
Else
.ColorIndex = 3 ' Red Text
End If
End With
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", ,
True
End Sub
Sub StopBlink()
ThisWorkbook.Worksheets("work").Range("g6").Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", ,
False
End Sub
ThisWorkbook:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Address = "$G$6" Then
StopBlink
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$G$6" Then
If Target.Text = "Already Posted" Then
StartBlink
End If
End Sub
Orlando Vazquez
"Chip Pearson" wrote:
> Put the following code in the ThisWorkbook code module.
>
> Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
> As Boolean)
> If Target.Address = "$A$1" Then
> StopBlink
> End If
> End Sub
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> If Target.Address = "$A$1" Then
> If Target.Text = "Already Posted" Then
> StartBlink
> End If
> End If
> End Sub
>
> The blinking will start when the value changes to "Already Posted" and
> will stop when the user double-clicks cell A1.
>
> Cordially,
> Chip Pearson
> Microsoft Most Valuable Professional
> Excel Product Group, 1998 - 2009
> Pearson Software Consulting, LLC
> www.cpearson.com
> (email on web site)
>
>
>
>
>
>
> On Thu, 2 Apr 2009 13:56:01 -0700, ORLANDO VAZQUEZ
> <(E-Mail Removed)> wrote:
>
> >Hi Chip,
> >
> >How can I rewrite the code below so that startblink does not start at the
> >opening of the spreadsheet but rather starts as a result of cell A1 value =
> >"Already Posted" ?
> >
> >And also I would like to be able to stop it at will, i.e., user acknowledges
> >it is in "already posted" status and clicks a button to stop it...
> >
> >Please help.
> >Thanks,
> >Orlando
> >
> >
> >Complete VBA Code
> >
> >Public RunWhen As Double
> >
> >Sub StartBlink()
> > With ThisWorkbook.Worksheets("Sheet1").Range("A1").Font
> > If .ColorIndex = 3 Then ' Red Text
> > .ColorIndex = 2 ' White Text
> > Else
> > .ColorIndex = 3 ' Red Text
> > End If
> > End With
> > RunWhen = Now + TimeSerial(0,0,1)
> > Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", ,
> >True
> >End Sub
> >
> >Sub StopBlink()
> > ThisWorkbook.Worksheets("Sheet1").Range("A1").Font.ColorIndex = _
> > xlColorIndexAutomatic
> > Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", ,
> >False
> >End Sub
> >
> >Then, in the ThisWorkbook code module of the workbook, use code like:
> >
> >Private Sub Workbook_Open()
> > StartBlink
> >End Sub
> >
> >Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > StopBlink
> >End Sub
>