How to set colour in particular cell in Excel

Hi al,
I am facing a scenario that I should set a colour in a particular cell range in excel . for example yes for green colour and no for red colour.

@mohan2,

Read the cell value and check if it is green or red.

Then use Set Range Color activity to set the color.

Hi @mohan2

Read each cell value and check with if condition and then use Set Range Color activity.

Set Range Color activity to set a color for a range(“A1:A2”) or a cell(“A1”).

To Set Green color use System.Drawing.Color.Green in Color and To Set Red color use System.Drawing.Color.Red in color input.

Regards,
Vijay Kumar C.

@mohan2

Use Set Range Color activity to set color for particular cell or given range.

1 Like

in set range colour activity , what range we will give.

Give the index of the cell.
ex: “A6”,“A1:A5”

@mohan2

You can give the range value like “A1”, “B6” for single cell and “A1:B6” for multiple cells.

@mohan2,

Read Index of that row also at the time of reading cell value.

If it is ‘B’ Column then specify set range as: “B”+index.toString

I don’t know that in which index the data will be there in excel, so it will be in dynamically. so I cant set the particular range value. becaz the yes or no will be in the random place in excel.

@mohan2,

Could you please send me sample excel file.

colour test.xlsx (7.8 KB)

@mohan2,

Is there any headers for this excel file or not ?

there is no header , but in that excel there is yes and no data, so I need colour for yes is green and no is red.

@mohan2

Is column number fixed for values Yes and No Like Always be 4th column ?

no the column number is not fixed , yes or no will anywhere in that excel. according that colour should set in the cell.

@mohan2,

Please find the attached file.
colorTest.zip (9.2 KB)