ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code help (https://www.excelbanter.com/excel-programming/427831-code-help.html)

Max

Code help
 
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



FSt1

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

i suspect that you haven't defined nextsecond properly.

Regards
FSt1

"MAX" wrote:

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



Max

Code help
 
I want cell B1 Flashing in all 3 sheets with blue and yellow.

"FSt1" wrote:

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

i suspect that you haven't defined nextsecond properly.

Regards
FSt1

"MAX" wrote:

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



JLGWhiz[_2_]

Code help
 
See Chip Pearson's site:

http://www.cpearson.com/excel/BlinkingText.aspx


"MAX" wrote in message
...
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





AltaEgo

Code help
 
You might try it this way:

http://excel.tips.net/Pages/T002134_Flashing_Cells.html

Creating a style is a snap:
Just select required cells, click Format, Styles and type "Flashing" into
the StyleName drop-down to add the new style.

--
Steve

"MAX" wrote in message
...
I want cell B1 Flashing in all 3 sheets with blue and yellow.

"FSt1" wrote:

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

i suspect that you haven't defined nextsecond properly.

Regards
FSt1

"MAX" wrote:

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



FSt1

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

regards
FSt1

"MAX" wrote:

I want cell B1 Flashing in all 3 sheets with blue and yellow.

"FSt1" wrote:

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

i suspect that you haven't defined nextsecond properly.

Regards
FSt1

"MAX" wrote:

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



Max

Code help
 
Yes

"FSt1" wrote:

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

regards
FSt1

"MAX" wrote:

I want cell B1 Flashing in all 3 sheets with blue and yellow.

"FSt1" wrote:

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

i suspect that you haven't defined nextsecond properly.

Regards
FSt1

"MAX" wrote:

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




All times are GMT +1. The time now is 02:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com