Change Font color based on the condition

Hi folks,

I need a help on changing the font color of particular cell to RED.

Condition is I want to add days(from C column) to the date column(B column) and if the date is less than today’s date then I want to change the font color for both column B and C like below.

Please check the input and output in below screenshot.

Searching for small solution where we can use invoke code or VBA.



Hi @shreyash_shirbhate ,

I believe you are able to perform this conditional check ? After Performing the conditional check, you could get the row numbers that matches the condition. Using the row numbers we can prepare the range that needs to be colored, provided we already know the Column Letters (B,C).

For Example, Array of Row Numbers received will store it in a variable, rowNumbersMatch,an array of Integer type, then we can use the below Expression to prepare the array of Ranges to be colored.

strRangesToColor = rowNumbersMatch.Select(Function(x)"B"+(x+2).ToString+":C"+(x+2).ToString).ToArray

strRangesToColor is a variable of type Array of String.

Then I believe we should be able to use the workflow in the below post for the Coloring using Invoke Code c# Interop methods :

Suggested for Invoke Code, but could also try with Modern Format Cells Activity.

Let us know if you are not able to get it working and let us know the issue faced.

1 Like

Hey, Thanks Arpan.:slight_smile: Let me try it and get back to you.

1 Like

Hi @supermanPunch,

I am done up to strRangesToColor part. I have all the ranges.

Can you please help what I need to give in below field? I refer the excel automation workflow but it is quite confusing.


I think i got it. Never mind. Thanks!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.