Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Run VBA code only worksheet change, but don't trigger worksheet_change event based on what the code does | Excel Programming | |||
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. | Excel Programming | |||
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... | Excel Programming | |||
Excel code convert to Access code - Concat & eliminate duplicates | Excel Programming |