Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi everybody, I have a code that makes a specific cell blinking .. it works very well, but with one cell only .. I tried to develop it to be active with more than one cell, but I could not. This is the code and I wish I could find the answer he Public Sub Blink() With Sheets(1).Range("A1").Interior If .ColorIndex = 2 Then ..ColorIndex = 3 Else ..ColorIndex = 2 End If End With appTime = Now() + TimeValue("00:00:01") Application.OnTime appTime, "Blink" End Sub Thank you, -- Jim333 ------------------------------------------------------------------------ Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186 View this thread: http://www.excelforum.com/showthread...hreadid=401858 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jim,
this is untested but it would go something like this Public Sub Blink() Dim rngCell as range Dim rngRegion as range set rngRegion =Sheets(1).Range("A1:d10") for each rngCell in rngRegion .Interior.ColorIndex = iif(.Interior.ColorIndex = 2,3,2) Next rngCell appTime = Now() + TimeValue("00:00:01") Application.OnTime appTime, "Blink" End Sub Robin Hammond www.enhanceddatasystems.com "Jim333" wrote in message ... Hi everybody, I have a code that makes a specific cell blinking .. it works very well, but with one cell only .. I tried to develop it to be active with more than one cell, but I could not. This is the code and I wish I could find the answer he Public Sub Blink() With Sheets(1).Range("A1").Interior If .ColorIndex = 2 Then ColorIndex = 3 Else ColorIndex = 2 End If End With appTime = Now() + TimeValue("00:00:01") Application.OnTime appTime, "Blink" End Sub Thank you, -- Jim333 ------------------------------------------------------------------------ Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186 View this thread: http://www.excelforum.com/showthread...hreadid=401858 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thank you for ur reply, the code didn't work with me,, Can u please test it and attach a file contains the tested code, thanks, -- Jim333 ------------------------------------------------------------------------ Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186 View this thread: http://www.excelforum.com/showthread...hreadid=401858 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jim,
Inserting a clearly intended With...End With clause, Robin's code ran without problem for me: Public Sub Blink() Dim rngCell As Range Dim rngRegion As Range Dim appTime As Double Set rngRegion = Sheets(1).Range("A1:d10") For Each rngCell In rngRegion With rngCell .Interior.ColorIndex = IIf(.Interior.ColorIndex = 2, 3, 2) End With Next rngCell appTime = Now() + TimeValue("00:00:01") Application.OnTime appTime, "Blink" End Sub --- Regards, Norman "Jim333" wrote in message ... Thank you for ur reply, the code didn't work with me,, Can u please test it and attach a file contains the tested code, thanks, -- Jim333 ------------------------------------------------------------------------ Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186 View this thread: http://www.excelforum.com/showthread...hreadid=401858 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thankyou Norman.
My mistake Jim. Robin Hammond www.enhanceddatasystems.com "Norman Jones" wrote in message ... Hi Jim, Inserting a clearly intended With...End With clause, Robin's code ran without problem for me: Public Sub Blink() Dim rngCell As Range Dim rngRegion As Range Dim appTime As Double Set rngRegion = Sheets(1).Range("A1:d10") For Each rngCell In rngRegion With rngCell .Interior.ColorIndex = IIf(.Interior.ColorIndex = 2, 3, 2) End With Next rngCell appTime = Now() + TimeValue("00:00:01") Application.OnTime appTime, "Blink" End Sub --- Regards, Norman "Jim333" wrote in message ... Thank you for ur reply, the code didn't work with me,, Can u please test it and attach a file contains the tested code, thanks, -- Jim333 ------------------------------------------------------------------------ Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186 View this thread: http://www.excelforum.com/showthread...hreadid=401858 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi Norman, And the code to turn this off would be ?? Dave Don't say the trash can. :) Norman Jones Wrote: Hi Jim, Inserting a clearly intended With...End With clause, Robin's code ran without problem for me: Public Sub Blink() Dim rngCell As Range Dim rngRegion As Range Dim appTime As Double Set rngRegion = Sheets(1).Range("A1:d10") For Each rngCell In rngRegion With rngCell .Interior.ColorIndex = IIf(.Interior.ColorIndex = 2, 3, 2) End With Next rngCell appTime = Now() + TimeValue("00:00:01") Application.OnTime appTime, "Blink" End Sub --- Regards, Norman "Jim333" wrot in message ... Thank you for ur reply, the code didn't work with me,, Can u please test it and attach a file contains the tested code, thanks, -- Jim333 ------------------------------------------------------------------------ Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186 View this thread http://www.excelforum.com/showthread...hreadid=401858 -- Piranh ----------------------------------------------------------------------- Piranha's Profile: http://www.excelforum.com/member.php...fo&userid=2043 View this thread: http://www.excelforum.com/showthread.php?threadid=40185 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dave,
Perhaps, by using a module level boolean (blStop) in conjunction with a macro (StartIt) to inititiate the blink routine and a macro (StopIt) to terminate the blink routine '====================== Option Explicit Public blStop As Boolean '------------------------------ Public Sub Blink() Dim rngCell As Range Dim rngRegion As Range Dim appTime As Double If blStop Then Exit Sub Set rngRegion = Sheets(1).Range("A1:d10") For Each rngCell In rngRegion With rngCell .Interior.ColorIndex = IIf(.Interior.ColorIndex = 2, 3, 2) End With Next rngCell appTime = Now() + TimeValue("00:00:01") Application.OnTime appTime, "Blink" End Sub '------------------------------ Public Sub StartIt() blStop = False Blink End Sub '------------------------------ Public Sub StopIt() blStop = True End Sub: '<<====================== BTW, Dave, I sincerely hope that you have not been converted to flash / blink phenomena - I thought *you* had more sense! --- Regards, Norman "Piranha" wrote in message ... Hi Norman, And the code to turn this off would be ?? Dave Don't say the trash can. :) Norman Jones Wrote: Hi Jim, Inserting a clearly intended With...End With clause, Robin's code ran without problem for me: Public Sub Blink() Dim rngCell As Range Dim rngRegion As Range Dim appTime As Double Set rngRegion = Sheets(1).Range("A1:d10") For Each rngCell In rngRegion With rngCell .Interior.ColorIndex = IIf(.Interior.ColorIndex = 2, 3, 2) End With Next rngCell appTime = Now() + TimeValue("00:00:01") Application.OnTime appTime, "Blink" End Sub --- Regards, Norman "Jim333" wrote in message ... Thank you for ur reply, the code didn't work with me,, Can u please test it and attach a file contains the tested code, thanks, -- Jim333 ------------------------------------------------------------------------ Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186 View this thread: http://www.excelforum.com/showthread...hreadid=401858 -- Piranha ------------------------------------------------------------------------ Piranha's Profile: http://www.excelforum.com/member.php...o&userid=20435 View this thread: http://www.excelforum.com/showthread...hreadid=401858 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Flashing cells | Excel Worksheet Functions | |||
flashing cells | Excel Worksheet Functions | |||
Flashing cells | Excel Worksheet Functions | |||
Flashing cells | Excel Discussion (Misc queries) | |||
flashing cells | Excel Discussion (Misc queries) |