How to check the checkbox on the excel sheet based on a condition

I have the use case as below. I want the bot to look in sheet 2 and check the box in sheet 1 if there is a date on column F or column G. Do you know how I can do that?

Input
Sheet1:
image

Sheet2:
image

Output
image

@ndtran85,

I assume the checkboxes are Excel Form Controls or Active X controls. To automate these, I would suggest to use VBA code invoked from UiPath.

For this you can use Read Range and then add your logic to check and use Execute Macro activity to run the VBA code.

You can record the VBA code to check the checkbox in Excel if you want to get the code auto generated.

Thanks,
Ashok :slight_smile:

@ashokkarale, thanks so much for replying! Can you share the VBA code?

@ndtran85,

If you can share the file here or personally I can record and give you but if not possible, you can do it on your own as well. Follow this steps:

Thanks,
Ashok :slight_smile:

@ashokkarale

Here is the file:
Input.xlsx (17.8 KB)
Thank you!

@ndtran85,

So your file Sheet 1 have 6 Checkboxes with non standard naming conventions those are:

Check Box 29
Check Box 28
Check Box 27
Check Box 21
Check Box 20
Check Box 1

You will have to keep this into some mapping file and as per your requirement just pass the checkbox name to Execute macro.

To Check the checkbox use this VBA code

ThisWorkbook.Sheets("Sheet1").CheckBoxes("Check Box 20").Value = 1

To Uncheck the checkbox use this code
ThisWorkbook.Sheets("Sheet1").CheckBoxes("Check Box 20").Value = -4146

Here Sheet name and Check Box name would be dynamic as per your requirement.

Sample in Excel:
Checkbox

Thanks,
Ashok :slight_smile:

somehow it does not work when i tried it. weird

Any error or behaviour of the code?