Hight light some characters in an Excel cell?

Is there anyway to highlight only some characters in a cell in Excel?
image

Any help would be appreciated!

Hi @Son_tran ,

As far now i could think of 3 ways for you to highlight the characters in excel.

1. Creating a template

  • Create 1 standard template of excel. Perform the cell formatting to the entire sheet.

  • Before updating the data in an excel, perform copying of the template and rename

  • update the data in the new file which is copied

  • Excel automatically format the data and highlight the characters

2. Create C# code

  • For Text color change :
[RangeObject].Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);

For cell background

[RangeObject].Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);

3. Create VBA Macro
Check the below link which will help you for creating macro

Regards,
Pavithra

2 Likes

Hello Pavithra,
Thank you for your help.
I’m still not able to know how to do this with UiPath so far.
Imagine that I have a cell formatted as text with 10 digits.
I would like to highlight the character from position 5 to position 7.
How can I do that?

image

Hi @Son_tran ,

As per my knowledge, in UiPath , with respect to actives, you have set color activity. However, with this activity the color of entire cell and not the character. So, the only work around is those 3 options which i mentioned earlier.

Hi @Son_tran

Use “Set Range Color” Activity.
Pass color( system.Drawing.Color.Red) and Cell Range

Regards
Gokul

Hi,

You can write simple vb code like below and use invoke code activity in uipath to achieve your requirement.

To set color for some characters in the whole characters in cell we can use cells character properties like below.

Cells(1,1).Characters(Start:=3, Length:=5).Font.Color = RGB(255, 0, 0)

If you want to apply lot of cells in singke column we can go by loop.

Please try and let me know if you need any further assistance. Thanks.

1 Like

Hi Kiran Kumar,
Perfect! It works like a charm!
Thank you very much!

1 Like

your most welcome @Son_tran .

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