Forum Discussion
blink a cell
- Mar 23, 2018
Hello.
If i recall correctly. I think i have answered similar question like this before.
I think you may have difficulty on how to replicate the solution in your own file.I have recorded a video on how you can do it by yourself.
This is the first part of the code that goes to a module
Option Explicit Public rRange As Range Dim dNextTime As Double Sub StartBlink() On Error GoTo ErrorHandle With rRange.Interior If .ColorIndex = 3 Then .ColorIndex = xlNone Else .ColorIndex = 3 End If End With dNextTime = Now + TimeSerial(0, 0, 1) Application.OnTime dNextTime, "StartBlink", , True Exit Sub ErrorHandle: MsgBox Err.Description & " Procedure StartBlink." Set rRange = Nothing End Sub Sub StopBlink() On Error GoTo ErrorHandle rRange.Interior.ColorIndex = xlNone Application.OnTime dNextTime, "StartBlink", , False BeforeExit: Set rRange = Nothing Exit Sub ErrorHandle: MsgBox Err.Description & " Procedure StopBlink." Resume BeforeExit End Suband this is the second part which goes to the Sheet Form object
Option Explicit Dim bCellCheck As Boolean Dim bBlink As Boolean Private Sub Worksheet_Change(ByVal Target As Excel.Range) Dim rColumn As Range Dim sAdress As String On Error GoTo ErrorHandle If Not IsEmpty(Range("B27")) Then Set rColumn = Range("B27") End If bCellCheck = False If Range("G27").Value = "" Then bCellCheck = True If Len(sAdress) > 0 Then sAdress = sAdress & "," & rColumn.Address Else sAdress = sAdress & rColumn.Address End If End If If bCellCheck = True And bBlink = False Then Set rRange = Range(sAdress) bBlink = True StartBlink ElseIf bCellCheck = True And bBlink = True Then Set rRange = rColumn StopBlink Set rRange = Range(sAdress) StartBlink ElseIf bCellCheck = False And bBlink = True Then Set rRange = rColumn StopBlink bBlink = False End If Exit Sub ErrorHandle: MsgBox Err.Description & " Procedure Worksheet_Change." Set rRange = Nothing Set rColumn = Nothing bCellCheck = False End Sub
Mr Jamil Mohammad
thank you for taking your precious time to reply to my queries
if you would kindly check the sheet "Form" in the <EUREKA Desking program..> file I emailed to you.
the sheet "Form" already had a macro = Private Sub Worksheet_Change(ByVal Target As Range)
how can I insert your macro - it has the same name (worksheet_Change)
also - it is cell G27 I would like to blink whenever B27 is blank.
Thank you for your patience and assistance
more power to you
You sent me files that are password protected. the sheet is protected so the macro would not work.
However, I have put the codes in the workbook to show you how it is done.
right now the macro throws error because the Form worksheet is protected. unprotect the worksheet then save and close it and then reopen and then see if the blinking works.
- Lorenzo KimMar 26, 2018Bronze Contributor
THANK YOU FOR YOUR VALUABLE TIME
- JamilMar 27, 2018Bronze ContributorI sent you your file by email.
- Lorenzo KimMar 27, 2018Bronze Contributor
Mr Jamil Mohammad
I changed sub startblink() to function startblink() as boolean and this does not show up in the macro box, will this have any effect on the program?
I do not want the blinking to appear on macro box - this may be manually manipulated and could hamper the program
if not so much of asking - pls help on the COPY SHEET deactivation, too
Thank you very very much
- JamilMar 27, 2018Bronze Contributoryou are welcome. :)