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 Cells flashing

I want cells B1 and F1 flashing, and I am using this code (below). When I run
the macro, it is giving me a compile error ( Block If without End If).
Any help please?

This is the 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"


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


ElseIf Range("B1").Interior.ColorIndex = 41 Then
Sheet1.Range("B1").Interior.ColorIndex = 7
Sheet1.Range("B1").Value = "Pink"



If Range("F1").Interior.ColorIndex = 7 Then
Sheet1.Range("F1").Interior.ColorIndex = 41
Sheet1.Range("F1").Value = "Light Blue"


ElseIf Range("F1").Interior.ColorIndex = 41 Then
Sheet1.Range("F1").Interior.ColorIndex = 7
Sheet1.Range("F1").Value = "Pink"

End If
End Sub


Thanks a lot.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Cells flashing

You are missing and End If after your firs If....ElseIf... statements.


"MAX" wrote in message
...
I want cells B1 and F1 flashing, and I am using this code (below). When I
run
the macro, it is giving me a compile error ( Block If without End If).
Any help please?

This is the 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"


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


ElseIf Range("B1").Interior.ColorIndex = 41 Then
Sheet1.Range("B1").Interior.ColorIndex = 7
Sheet1.Range("B1").Value = "Pink"



If Range("F1").Interior.ColorIndex = 7 Then
Sheet1.Range("F1").Interior.ColorIndex = 41
Sheet1.Range("F1").Value = "Light Blue"


ElseIf Range("F1").Interior.ColorIndex = 41 Then
Sheet1.Range("F1").Interior.ColorIndex = 7
Sheet1.Range("F1").Value = "Pink"

End If
End Sub


Thanks a lot.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Cells flashing

Please read the opening paragraph and BE SURE TO READ the last item in the
Summary at the bottom of the page...

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

--
Rick (MVP - Excel)


"MAX" wrote in message
...
I want cells B1 and F1 flashing, and I am using this code (below). When I
run
the macro, it is giving me a compile error ( Block If without End If).
Any help please?

This is the 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"


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


ElseIf Range("B1").Interior.ColorIndex = 41 Then
Sheet1.Range("B1").Interior.ColorIndex = 7
Sheet1.Range("B1").Value = "Pink"



If Range("F1").Interior.ColorIndex = 7 Then
Sheet1.Range("F1").Interior.ColorIndex = 41
Sheet1.Range("F1").Value = "Light Blue"


ElseIf Range("F1").Interior.ColorIndex = 41 Then
Sheet1.Range("F1").Interior.ColorIndex = 7
Sheet1.Range("F1").Value = "Pink"

End If
End Sub


Thanks a lot.


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
Flashing cells MAX Excel Worksheet Functions 1 April 28th 09 02:36 AM
flashing cells MAX Excel Worksheet Functions 0 April 27th 09 10:12 PM
Flashing cells MAX Excel Worksheet Functions 3 April 27th 09 04:55 PM
flashing cells ketilla Excel Discussion (Misc queries) 1 April 10th 08 05:13 PM
Flashing Cells Jim333[_10_] Excel Programming 9 September 10th 05 11:28 AM


All times are GMT +1. The time now is 10:59 PM.

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"