Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Flashing cells

Will you please tell me what's wrong with this code?

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"

With Sheets("Serie A")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41



ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3


With Sheets("Serie B")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41



ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3
End If
End With
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default Flashing cells

It tries to make worksheet cells flash.

Seriously, why do you think something is wrong with it? Do you get error
messages or unexpected behavior? If so what?

Best wishes Harald


"MAX" wrote in message
...
Will you please tell me what's wrong with this code?

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"

With Sheets("Serie A")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41



ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3


With Sheets("Serie B")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41



ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3
End If
End With
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Flashing cells

This code is giving me Block If without End If

"Harald Staff" wrote:

It tries to make worksheet cells flash.

Seriously, why do you think something is wrong with it? Do you get error
messages or unexpected behavior? If so what?

Best wishes Harald


"MAX" wrote in message
...
Will you please tell me what's wrong with this code?

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"

With Sheets("Serie A")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41



ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3


With Sheets("Serie B")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41



ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3
End If
End With
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Flashing cells

You have two With statements but only one End With statement.

--
Rick (MVP - Excel)


"MAX" wrote in message
...
This code is giving me Block If without End If

"Harald Staff" wrote:

It tries to make worksheet cells flash.

Seriously, why do you think something is wrong with it? Do you get error
messages or unexpected behavior? If so what?

Best wishes Harald


"MAX" wrote in message
...
Will you please tell me what's wrong with this code?

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"

With Sheets("Serie A")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41



ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3


With Sheets("Serie B")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41



ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3
End If
End With
End Sub




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Flashing cells

There is also an End If missing

"Rick Rothstein" wrote in message
...
You have two With statements but only one End With statement.

--
Rick (MVP - Excel)


"MAX" wrote in message
...
This code is giving me Block If without End If

"Harald Staff" wrote:

It tries to make worksheet cells flash.

Seriously, why do you think something is wrong with it? Do you get error
messages or unexpected behavior? If so what?

Best wishes Harald


"MAX" wrote in message
...
Will you please tell me what's wrong with this code?

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"

With Sheets("Serie A")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41



ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3


With Sheets("Serie B")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41



ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3
End If
End With
End Sub







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Flashing cells

Because your'e using ElseIf, both statements (interiorColor=3 & 41) are
evaluated within each second that's why it's not noticable the changes, use
instead Else as follows:

With Sheets("Serie A")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"
Else
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"
End If
End With

"MAX" wrote in message
...
Will you please tell me what's wrong with this code?

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"

With Sheets("Serie A")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41



ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3


With Sheets("Serie B")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41



ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3
End If
End With
End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cells flashing MAX Excel Programming 2 May 6th 09 07:35 AM
Flashing cells MAX Excel Worksheet Functions 1 April 28th 09 02:36 AM
Flashing cells MAX Excel Worksheet Functions 3 April 27th 09 04:55 PM
Flashing cells Tim Turner Excel Discussion (Misc queries) 3 January 30th 09 04:43 AM
Flashing Cells Jim333[_10_] Excel Programming 9 September 10th 05 11:28 AM


All times are GMT +1. The time now is 07:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"