Flashing date macro in Excel
Solved
edgc
Posted messages
7
Status
Member
-
motorest -
motorest -
Hello everyone,
I want to create a table with:
A date in A1
A formula in cell B1 that adds 10 days to the date
I want the result in cell B1 to make the cell blink when the new date is reached.
Can anyone help me?
Just to let you know, I'm not great with macros, this is my first attempt!
Configuration: Windows 7 / Internet Explorer 9.0
I want to create a table with:
A date in A1
A formula in cell B1 that adds 10 days to the date
I want the result in cell B1 to make the cell blink when the new date is reached.
Can anyone help me?
Just to let you know, I'm not great with macros, this is my first attempt!
Configuration: Windows 7 / Internet Explorer 9.0
20 answers
-
Re,
Forget the EDGC request, each code is specific. In your case, you should have opened your own discussion.
If I understand your request correctly, in column F you enter the sending date and in column J the concerned item, in column ? which remains to be defined, the return quote date.
If the date in column ? where you need to enter the return quote date is empty and the date in column F is more than 15 days prior to today, the cells in columns F and J will flash and stop when you enter the return date in column ?
Is that right?
--
A+
Mike-31
A period of failure is a perfect time to sow the seeds of knowledge. -
Re,
Paste this code into a module and associate each macro with a button to test if it meets your expectations; we'll see later about the improvement.
Option Explicit
Dim BlinkTime As Date
Dim c, x As Range
Public Sub Clignot()
On Error Resume Next
For Each c In Sheets("Sheet1").Range("A2:A150").Cells 'Blinking area
If c.Interior.ColorIndex = -4142 Then
If c.Value <> "" And c.Offset(0, 2) = "" And c.Value + 15 <= Date Then
c.Interior.ColorIndex = 3 'Red
Else
c.Interior.ColorIndex = 0 'White currently 0 to be checked
End If
Else
c.Interior.ColorIndex = 0
End If
Next c
BlinkTime = Now() + TimeValue("00:00:01") 'the blinking time
Application.OnTime BlinkTime, "Clignot"
End Sub
Sub ArretClignot()
On Error Resume Next
Application.OnTime BlinkTime, "Clignot", , False
Sheets("Sheet1").Range("F2:F19,J2:J19").Interior.ColorIndex = xlNone
End Sub
--
A+
Mike-31
A period of failure is a perfect time to sow the seeds of knowledge. -
Re,
In the properties of your sheet, paste these three codes (right-click on the relevant sheet tab/view code)
the first code automatically starts the blinking as soon as you return to the sheet, the second stops the blinking to allow comfortable editing of the cells, and the third stops the blinking as soon as you leave the sheet, which facilitates data entry in the workbook sheets
Private Sub Worksheet_Activate()
Call Clignot
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A:C")) Is Nothing Then
Call ArretClignot
Columns("A:C").Interior.ColorIndex = xlNone
End If
Call Clignot
End Sub
Private Sub Worksheet_Deactivate()
Call ArretClignot
End Sub
In the ThisWorkbook, these two codes, one to stop the blinking when closing the workbook and one to select the sheet named "Feuil1" (to be adjusted) when opening and thus start the blinking
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call ArretClignot
End Sub
Private Sub Workbook_Open()
Sheets("Feuil1").Select
Call Clignot
End Sub
in a module, paste these two codes, one that controls the blinking and one to stop it
Option Explicit
Dim BlinkTime As Date
Dim c, x As Range
Public Sub Clignot()
On Error Resume Next
For Each c In Sheets("Feuil1").Range("A2:A150").Cells 'Blinking area
If c.Offset(0, 2).Interior.ColorIndex = -4142 Then
If c.Value <> "" And c.Offset(0, 2) = "" And c.Value + 15 <= Date Then
c.Offset(0, 2).Interior.ColorIndex = 3 'Red
Else
c.Offset(0, 2).Interior.ColorIndex = 0 'White2 currently 0 to see
End If
Else
c.Offset(0, 2).Interior.ColorIndex = 0
End If
Next c
BlinkTime = Now() + TimeValue("00:00:01") 'the blinking time
Application.OnTime BlinkTime, "Clignot"
End Sub
Sub ArretClignot()
On Error Resume Next
Application.OnTime BlinkTime, "Clignot", , False
Sheets("Feuil1").Range("F2:F19,J2:J19").Interior.ColorIndex = xlNone
End Sub
by setting the codes this way, any button is unnecessary, and if you wish, it is possible to make the affected cells A, B, and C blink
A+
Mike-31
A period of failure is a perfect time to sow the seeds of knowledge. -
Hello,
There is no formula to make a cell or the value contained in a cell blink, the only solution is VBA.
At the conclusion of your request "Be careful, I am bad with macros, this is my first attempt!"
the best would be to post your file so that we can apply the code to it.
To attach your file with this link
https://www.cjoint.com/
--
See you!
Mike-31
A period of failure is a perfect time to sow the seeds of knowledge. -
Hi,
you could also use conditional formatting; this way of doing it doesn't make the cell blink but you can display the text or the background of the cell in a color of your choice.
Thank you
--
Every problem has a solution... you just need to be persistent. -
Good evening,
I would prefer to have a blinking cell because it's more visual when you don't have your eye constantly on your Excel sheet.
Thank you for your response. -
Re,
To write VBA code, one must be precise; if you're asked for a file example, it's primarily to save us time and adapt a code to the file's structure.
Your file is taking a while to arrive, so I'm signing off for tonight; tomorrow will bring a new day.
--
See you later
Mike-31
A period of failure is a perfect moment to sow the seeds of knowledge.-
Sorry for this late response!
Here is the file attached.
It is the gray cells that I would like to make flash (in red if possible) when the date is exceeded.
Thank you for your help.
https://www.cjoint.com/?0KbmdmLa36w
-
-
Re,
In your request, you wanted to make a cell in B blink if the date was 10 days greater than the date in A.
In your attached file, the dates in F and J are only one day greater, and the blinking is determined by the date in F and J compared to today, meaning that if the date in these two columns is today, the cell blinks, even if it's today or earlier.
In the example, the blinking is related to today.
https://www.cjoint.com/?BKbqkzCCUN8
--
Best,
Mike-31
A period of failure is a perfect time to sow the seeds of knowledge. -
Good evening,
When I asked my question, my file had not yet been created; it was just an example I wanted to replicate at my convenience.
I created this beginning of the file this afternoon to be able to submit it to you.
In fact, I want the cells in columns F and J to blink when the date is reached and to remain blinking even if the date has passed.
Ideally, I would like to be able to cancel the blinking by pressing a button or something similar (for example).
Thank you for your help. -
Re,
As such
https://www.cjoint.com/?BKbvtrPFHip
--
See you +
Mike-31
A period of failure is a perfect time to sow the seeds of knowledge. -
Great like that!
But one for each line, to delete each line as soon as I'm done. -
Re,
what do you mean by
But one for each line, to erase each line as soon as I’m done
--
A+
Mike-31
A period of failure is a perfect time to sow the seeds of knowledge. -
Let's focus on a flashing date as soon as it is exceeded
The rest doesn't matter
Thank you -
Re,
So the file is good, right?
--
See you +
Mike-31
A period of failure is a perfect time to sow the seeds of knowledge. -
Great,
It works as I wanted it to.
I hadn't noticed the flickering earlier because macros were disabled.
Sorry and thank you again. -
Hello,
This macro is very interesting
Would there be an improvement to stop the blinking based on an intervention date in the same row but in a different cell?
Example with the same file as before, if we enter a date in the scheduled intervention date cell, the blinking stops only on the concerned row.
Thanks in advance
Cédric -
Thank you for this quick response.
In fact, I started from the file that is in the "EDGC" request above.
They wanted to make the cells in columns F and J blink based on the current date and a given value.
I'm looking to stop the blinking in the cells when I enter a value (date) in one of the following columns
For this file, the blinking stops if I enter a value (date) in column M.
For my personal application, I adapted the macro to another file, but I can't find the solution.
My file includes a date of sending an item for repair in a "cell".
After 15 days without a quote, a cell starts to blink in red.
As soon as I receive the quote, I enter the reception date and the cell stops blinking.
Is this feasible?
Thank you in advance. -
So we forget the previous file.....
In column A I enter the shipping date.
In column C my quote receipt date.
From the moment I have entered a shipping date in A
and that in relation to today's date, 15 days have passed without receiving a quote, my column C starts to blink until I enter a date in the blinking column "C"
Is this valid for 150 Excel rows?
Thank you in advance
Cédric -
Thank you,
I have tested a bit in all directions to see if everything works. This macro works well.
The sending date blinks properly once we have exceeded 15 days.
And it stops blinking when we enter a date in column C.
There are a few issues with additional entries, but nothing serious.
But I am actually being a bit greedy; I would like it to be cell C and not A
the "quotation receipt date" that blinks as long as we have not entered any date in C.
We keep everything, we just need the blinking to occur in column C.
............. A.......................................B............................................C
Sending date in repair...... repairer......................quotation receipt date
01/11/2013............................... rep 1
15/11/2013;...............................rep 12
................................................. rep 16
..................................................rep 9
Thank you
Cédric -
Hello,
Thank you, it works great,
I took a little time to respond because I wanted to understand what I was doing.
Not everything is clear to me yet, but I managed to get it working on my file by adapting the codes.
Thanks again, I'm going to dig deeper into this.
Cédric