Change cell color every 7 days

Closed
kusart - Oct 14, 2009 at 03:11 AM
 vertix - Dec 22, 2011 at 01:17 PM
Hello,
Is there any way to change a cell's color once a week on a certain day on a regular basis. Example, only on Wednesdays cell color changes to pink automatically. Then reverts back to its original color on every other day untill Wednesday comes around again, and so on. . .
Related:

1 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Oct 14, 2009 at 06:00 AM
try this. I could not test as I have to wait for seven days to completely test. Today 14th October it works.

first type in A1
=today()

right click the tab of the sheet and click view code. and in that window copy this code


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$A$1" Then Exit Sub

If Weekday(Range("A1")) Mod 7 = 4 Then
Range("B1").Interior.ColorIndex = 3
Else
Range("B1").Interior.ColorIndex = xlNone

End If
End Sub



everyday automatically the entry in A1 will change to that day
now when the week day of A1 becomes Wednesday the color in B1 will change to red.

check for a few days and confirm whether it is ok
0
Thanks dude. You obviously put a lot of effort into this formula, but I was hoping for something simpler which I could insert into certain cells of my choice via 'conditional formatting' of the individual cells, etc. What you gave my up there is way over my head.
0
Trowa > kusart
Oct 19, 2009 at 09:13 AM
Hi Kusart,

Use this formula to determine the day (in cell A1 for example):
=weekday(today())
This formula give you a number: Sunday=1, Monday=2 etc.
Now you can use conditional formating.
Use formula is, and input A1=4 (4 for wednesday) and apply your color.
For your next condition use this formula: A1<>4 and apply your color.

Is this the answer you were looking for?

Best regards,
Trowa
0
hi i tried ur formula in vb and its working but how i can rest it untill the next date
0
how i can reset it untill the next date
0
thank you trowa for the vb formula ,tell me how i can reset the red color in b1 untill next date
0