Hi, Is there a way to highlight rows using uipath? I oni know uipath can highlight elements on screen.
Im using add data row to build the data table. I would like to highlight the whole row if one of the if condition is false. is there any way i can go about with it?
Could you specify what do you mean by âhighlight rowsâ in this context?
Do you mean whether it is possible to highlight the rows in the output Excel file?
If so, I would add additional column to the data table that would keep the flag given by the IF statement.
Then, I would execute the macro on the output Excel file that would apply conditional formatting based on that flag.
First, I donât think it is possible to save the entire data table to an Excel file together with any formatting.
This means that any highlighting must be done afterwards (after the Write Range activity).
There might be some custom activities around that maybe allow saving on a row per row basis with customer formatting included, granted you are using the Excel Scope and not a simple Write Range activity.
However, if you are using a simple Write Range activity, you can simply add a column to your Data Table that will store âTrueâ if you want to highlight the row and âFalseâ if you donât.
Then, after your save action is done, you can execute a VBA code on the same file to add the conditional formatting that will highlight the rows based on the Highlight Column value, either True or False.
I understand it is a bit complicated approach, but I cannot see a simpler way.
Yes, you could first append range and then use Invoke VBA activity within the same Excel Scope. You could also try to navigate the menus in Excel to add the conditional formatting manually
As to writing a value to the column, you need to do this when your before mentioned IF condition is false. By this point you assign the value of the data table column to either True or False.
If all happens within a For Each Row activity, do it like that with an Assign activity: row.Item("yourColumnName") = "True"
This will require you to do some research and try and error, but I can help you to start
See the attached example for a working solution: HighlightRows.zip (8.2 KB)
What you will need to adapt is the target range and the color of the highlight in your script. You can do that by editing the .vbs file in the notepad (or any other text editor, I use Notepad++).
As far as getting the code yourself, you can google about recording macros in Excel. You can then examine it and adapt it from there