Help Changing Cell Color to Based of Date referring to a specific Interior Cell Color

ashringg

New Member
Joined
Nov 2, 2023
Messages
13
Office Version
  1. 2016
Platform
  1. Windows
Happy New Year!

I am working on my yearly calendar which is on one sheet. I usually manually change the cell color to match the month and then bold Sundays (attached is my 2023 calendar) but I have been trying to get into Macros more.

Unfortunately, I cannot figure out VBA to change the cell's interior color based on the month and corresponding reference color. I don't even know where to start on how to code to bold Sundays. Can you please help?

Summary Calendar.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1Jan 1Jan 2Jan 3Jan 4Jan 5Jan 6Jan 7Jan 8Jan 9Jan 10Jan 11Jan 12Jan 13Jan 14Jan 15Jan 16Jan 17Jan 18Jan 19Jan 20Year2024
2Jan 21Jan 22Jan 23Jan 24Jan 25Jan 26Jan 27Jan 28Jan 29Jan 30Jan 31Feb 1Feb 2Feb 3Feb 4Feb 5Feb 6Feb 7Feb 8Feb 9Month ColorRGBHex
3Feb 10Feb 11Feb 12Feb 13Feb 14Feb 15Feb 16Feb 17Feb 18Feb 19Feb 20Feb 21Feb 22Feb 23Feb 24Feb 25Feb 26Feb 27Feb 28Feb 29Jan255204255#FFCCFF
4Mar 1Mar 2Mar 3Mar 4Mar 5Mar 6Mar 7Mar 8Mar 9Mar 10Mar 11Mar 12Mar 13Mar 14Mar 15Mar 16Mar 17Mar 18Mar 19Mar 20Feb204204255CCCCFF
5Mar 21Mar 22Mar 23Mar 24Mar 25Mar 26Mar 27Mar 28Mar 29Mar 30Mar 31Apr 1Apr 2Apr 3Apr 4Apr 5Apr 6Apr 7Apr 8Apr 9Mar204236255CCECFF
6Apr 10Apr 11Apr 12Apr 13Apr 14Apr 15Apr 16Apr 17Apr 18Apr 19Apr 20Apr 21Apr 22Apr 23Apr 24Apr 25Apr 26Apr 27Apr 28Apr 29Apr204255255CCFFCC
7Apr 30May 1May 2May 3May 4May 5May 6May 7May 8May 9May 10May 11May 12May 13May 14May 15May 16May 17May 18May 19May204255204CCFFCC
8May 20May 21May 22May 23May 24May 252024May 26May 27May 28May 29May 30May 31Jun 1Jun204255253CCFF99
9Jun 2Jun 3Jun 4Jun 5Jun 6Jun 7Jun 8Jun 9Jun 10Jun 11Jun 12Jun 13Jun 14Jul255255204FFFFCC
10Jun 15Jun 16Jun 17Jun 18Jun 19Jun 20Jun 21Jun 22Jun 23Jun 24Jun 25Jun 26Jun 27Aug255247239FFF7EF
11Jun 28Jun 29Jun 30Jul 1Jul 2Jul 3Jul 4Jul 5Jul 6Jul 7Jul 8Jul 9Jul 10Sep255204153FFCC99
12Jul 11Jul 12Jul 13Jul 14Jul 15Jul 16Jul 17Jul 18Jul 19Jul 20Jul 21Jul 22Jul 23Oct255204204FFCCCC
13Jul 24Jul 25Jul 26Jul 27Jul 28Jul 29Jul 30Jul 31Aug 1Aug 2Aug 3Aug 4Aug 5Aug 6Aug 7Aug 8Aug 9Aug 10Aug 11Aug 12Nov252166180FCA6B4
14Aug 13Aug 14Aug 15Aug 16Aug 17Aug 18Aug 19Aug 20Aug 21Aug 22Aug 23Aug 24Aug 25Aug 26Aug 27Aug 28Aug 29Aug 30Aug 31Sep 1Dec233219233E9DBE9
15Sep 2Sep 3Sep 4Sep 5Sep 6Sep 7Sep 8Sep 9Sep 10Sep 11Sep 12Sep 13Sep 14Sep 15Sep 16Sep 17Sep 18Sep 19Sep 20Sep 21
16Sep 22Sep 23Sep 24Sep 25Sep 26Sep 27Sep 28Sep 29Sep 30Oct 1Oct 2Oct 3Oct 4Oct 5Oct 6Oct 7Oct 8Oct 9Oct 10Oct 11
17Oct 12Oct 13Oct 14Oct 15Oct 16Oct 17Oct 18Oct 19Oct 20Oct 21Oct 22Oct 23Oct 24Oct 25Oct 26Oct 27Oct 28Oct 29Oct 30Oct 31
18Nov 1Nov 2Nov 3Nov 4Nov 5Nov 6Nov 7Nov 8Nov 9Nov 10Nov 11Nov 12Nov 13Nov 14Nov 15Nov 16Nov 17Nov 18Nov 19Nov 20
19Nov 21Nov 22Nov 23Nov 24Nov 25Nov 26Nov 27Nov 28Nov 29Nov 30Dec 1Dec 2Dec 3Dec 4Dec 5Dec 6Dec 7Dec 8Dec 9Dec 10
20Dec 11Dec 12Dec 13Dec 14Dec 15Dec 16Dec 17Dec 18Dec 19Dec 20Dec 21Dec 22Dec 23Dec 24Dec 25Dec 26Dec 27Dec 28Dec 29Dec 30
21Dec 31
Summary Calendar
Cell Formulas
RangeFormula
A1A1=DATE($W$1,1,1)
B1:T7,O8:T12,B8:F20,G13:T20B1=A1+1
A2:A20A2=T1+1
G8G8=A1
N8:N12N8=F8+1
A21A21=IF(IF(T20+1=$A$1+365," ",T20+1)=""," ",T20+1)
B21B21=IF(IF(A21=" "," ",A21+1)=" ",A21+1," ")
C21:T21C21=IF(B21=" "," ",B21+1)
 

Attachments

  • 2023 example calendar.png
    2023 example calendar.png
    194.3 KB · Views: 11

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I usually manually change the cell color to match the month and then bold Sundays
You can try using Conditional formatting for that - 12 or lesser rules for each month and one rule for sundays, Plus if any holidays to be marked separately
 
Upvote 0
I still cannot apply it. I go to conditonal format. Highlight cell if month(1).
Sorry I was not well (hospitalised) so couldn't revert back any earlier.

You have to use the formula I gave in #5, as it is (no modification) on the entire sheet to Conditional Format.

If you are still not able to do so. Then share the screenshot(s) of your procedure(s) to let me understand and find where the challenge is.

Also, Can you share the formula of the cell where Jan 1 is appearing in calendar.

Still, First thing First - Try the formula I gave in #5 the way I have just explained and revert. It shall work for you.
 
Upvote 0
Sorry I was not well (hospitalised) so couldn't revert back any earlier.

You have to use the formula I gave in #5, as it is (no modification) on the entire sheet to Conditional Format.

If you are still not able to do so. Then share the screenshot(s) of your procedure(s) to let me understand and find where the challenge is.

Also, Can you share the formula of the cell where Jan 1 is appearing in calendar.

Still, First thing First - Try the formula I gave in #5 the way I have just explained and revert. It shall work for you.
Oh no i hope you're feeling better! I had to figure it out but it finally worked. I couldnt figure out which type of rule.
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,975
Members
449,095
Latest member
Mr Hughes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top