Conditionnal formating in VBA

stoure

New Member
Joined
Dec 23, 2016
Messages
26
Hi!
I've a conditionnal formatting formula in EXCEL, I'd like to use macro to do so. Thanks.
Code:
=SOMMEPROD(($C$5>=INDIRECT("Leave[departure]"))*($C$5<=INDIRECT("Leave[return]"))*($B8=INDIRECT("Leave[workers]")))
applied on
Code:
=$C$8:$G$14
I'd like to do it on the table below with colour... Thanks

[TABLE="width: 957"]
<colgroup><col><col span="13"><col><col><col span="20"></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 5"]Monday 01
[/TD]
[TD="colspan: 5"]Tuesday 02
[/TD]
[TD="colspan: 5"]Wednesday 03
[/TD]
[TD="colspan: 5"]Thursday04
[/TD]
[TD="colspan: 5"]Friday 05
[/TD]
[TD="colspan: 5"]Saturday 06
[/TD]
[TD="colspan: 5"]Sanday 07
[/TD]
[/TR]
[TR]
[TD]start
[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD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D] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 35"]Semaine du 08/01 au 14/01 2018[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 5"]lundi 08[/TD]
[TD="colspan: 5"]mardi 09[/TD]
[TD="colspan: 5"]mercredi 10[/TD]
[TD="colspan: 5"]jeudi 11[/TD]
[TD="colspan: 5"]vendredi 12[/TD]
[TD="colspan: 5"]samedi 13[/TD]
[TD="colspan: 5"]dimanche 14[/TD]
[/TR]
[TR]
[TD]debut[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]fin[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[TD]06[/TD]
[TD]13[/TD]
[TD]18[/TD]
[TD]20[/TD]
[TD]00[/TD]
[/TR]
[TR]
[TD]agent1[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]agent2[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]agent3[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
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]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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