Conditionnal formatting using macro

Nikita - Mar 14, 2011 at 05:36 PM
 Niki - Apr 13, 2011 at 01:20 PM

I am trying to create a calendar in excel in which certain days shoulded be marked with a colour.
In my excel file, one day is one column and on each row there is a certain time interval that indicates which days on that line should get a colour. (each row has a different time interval)

In order to automate the formatting I should be able to write the following condition in VBA but I don't know how to...


For each cell, the macro should first record the date which is mentionned on row number 12 in each column.
And then the macro should check whether the date is in the interval and if yes, the cell should get a certain colour...

Could someone please help me on this matter?

Thanks in advance.


2 replies

RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 120
Mar 15, 2011 at 01:42 AM
Could you please upload a sample EXCEL file WITH sample data, macro, formula , conditional formatting etc on some shared site like ,, , etc
AND post back here the link to allow better understanding of how it is now and how you foresee. Based on the sample book, could you re-explain your problem too.

Note: your data need not be to be real data but a good representative of how data looks like

Here's the link where you can find my file:

There is a conditionnal formatting applied in the file which gives the green colour in cel AY14-BC14 derived from the time interval between AB14 and AC14.

Since I want to add extra time intervals per row, so that on one row I can have multiple coloured cells, I need to put my conditionnal formatting in VBA.

Hope this is a bit clear, thanks a lot for the help!