How to change the font color in the excel cell

@supermanPunch Yes sir, It’s a lengthy process. is there any other way?

@Vrushali_Gave Are you updating the Column Directly without any condition or is there a validation in place before updating ,Also is the Column to be updated already known or is it dynamic. If it is already known, you can assign the column name directly and remove the Number to Letter workflow.

Also let us know from your perspective as to why you think this is a lengthy process.

@supermanPunch Yes sir, the Column name is dynamic. I have tried your code but I’m getting an error for the VBA activity

image

@Vrushali_Gave Are you able to execute the Macro Manually by replacing the columnIndex with a cell number like “A1” ?

Also can you post the Screenshot of the Complete error ?

@supermanPunch No, I’m not aware about Macro. Sir is there any simple way to change text font color?

@Vrushali_Gave If you are allowed to change the Excel Settings, Can you Perform this Change and then check if the workflow works.
Go to Excel - > Options → Trust Center → Trust Center Settings → Macro Settings → Enable All Macros.

Click on Ok.

Let us know if you are not able to do this or if you still receive the same error even after the change.

@supermanPunch Yes, I have changed the setting. No error occurred but the font color has not changed.

I have attached the workflow
Main.xaml (12.7 KB)

Excel o/p:
image

@Vrushali_Gave What value are you passing to the columnName variable in Invoke VBA ?

I guess it is Empty, Can you check on that and revert back ?

@supermanPunch Yes right, I have modified it.

image

But same output as previous.

colIndex is today date and that is the column name

@Vrushali_Gave colIndex refers to the Index of the Column and not the column name, According to the Workflow that you have provided you need to use Now.ToString(“dd”) as the column name for identification of the column to be updated in the DT.
But to Change the Color of the Updated value in the Excel you would need to have the column names of the Excel i.e A, B, C, …

I have recognised that you have not used the Number To Letter workflow for retrieving the Column Name of the excel dynamically, but it is very much needed if the Column name is not known.

Note that, The Column Names of the Datatable are different and the Column Name that we need to identify for Changing the Font Color is different.

Can you just execute the below workflow and let me know if it worked. The Test Excel file should have the values under the Column “Update” in red color after the execution.

Excel_Automation.zip (16.5 KB)

Then accordingly, you could use your Input file and Column Name, by only changing the values present in the First two Assign Activities and then Execute for your Inputs.

Let us know if you are still facing issues.

@supermanPunch Yes sir. it’s worked perfectly for a normal excel sheet. for example: For Calibri, Arial, etc. font. Thank you so much.

But sir in my case I have another format of sheet. The font is Symbol. The color doesn’t change here.

Could you please check for this format? I have attached the sheet
Book1.xlsx (8.9 KB)

Thank you

@Vrushali_Gave I was able to Change the Color of the Value that was written, But since the Font format was Symbol, the value “C” had changed to X.

image

@supermanPunch Sir, see

image

I have attached the original sheet.
Could you please check for the attached sheet3?

Book1.xlsx (12.1 KB)

Best Regards,
Vrushali

@Vrushali_Gave I am able to perform the operation for that sheet as well.

image

Can you provide the entire workflow ? Maybe there is some correction needed in the logic :sweat_smile:

Or there may be a shift in Sheets maybe from one sheet to another, so it doesn’t update in the right sheet.

1 Like

@supermanPunch
Yes, I have to change text color for three sheets. In my workflow it execute one by one
I have attached the workflow

Demo26.xaml (20.4 KB)

Thanks in advanced

Hi @supermanPunch ,

Have you checked this one to change the style of the font with more features.

Regards
Balamurugan.S

1 Like

@Vrushali_Gave You have provided an Excel file with two sheets in it, Sheet1 and Sheet3. The Sheet2 is missing or it shouldn’t be included in the SheetNames argument.

Also can you tell why have you used “B1” and “B4” and “B5” as the starting range while using Write Range or Read Range at some places ?

I think the differences in the ranges can cause the differences in Changing the font color. Maybe you can provide a more detailed explanation as to what you are performing ?

@supermanPunch Sir, could you please try with the following attached excel file.
The file has three sheets.

Steps of the workflow:

  1. I’m adding today’s date as a column name
  2. Writing data in today’s column using row index
  3. Now, I want to change the column text color to red

Excel sheet : Book1.xlsx (14.1 KB)

Workflow : Demo26.xaml (20.4 KB)

I want to write in excel from the B5 row column and also want to change the color of text written from B5 to below

Thanks in advanced

@Vrushali_Gave As I have understood your Workflow, You would want to use the same logic for all the 3 Sheets in the Excel file. But I think the 3 sheets do not hold a common update point and hence we would need to use separate logic for 3 of those sheets.

Also Do you want to update all the 3 sheets from B5 position ?

@supermanPunch B5 is fixed position for all the 3 sheets. Bot adding “C” for every column in the 3 sheets

Why the sheets are not holding a common update point?