Move from one sheet to another in one excel file

Hi Guys,
It seems very novice question but still had to ask because I did not find any solution yet.

I have one excel file with 3 sheets. In sheet1 there is a macro which I have to run at first. But when I open the excel file with “Excel application scope”, sometimes sheet2 is activated and that’s why it can not run the macro (button for this macro is in sheet1).

However, after this, I have to go back to sheet2 to read some data. Could you please tell my how can I move there by some uipath acitivites?
For example, if I use “Excel Write cell”, I can specify the ‘sheet’, which is fine to move to any sheet. But when I want to use any other acitivity, like, “Execute macro”, how can I specify the sheet?

Thanks in advance!

You can install UiPathTeam.Excel.Extensions.Activities and use the Activate Sheet activity before executing the macro.

I’ve used VBA more and I know in that you can specify which sheet to work on, is it possible to do that in the macro?

1 Like

@jahidKM

For Running a macro Sheet name is not required. We just require excel application scope activity.
After that use Execute macro actiivty where specify the macro name.
Which sheet need to be executed you can take care in building the macro.

Regards,
Ahtesham

1 Like

Either precede the macro with the sheetname that it lives in or make the macro more generic by creating it in a module instead of a sheet

1 Like

Thanks, it works perfectly in my case. As I am not macro expert, this is the optimal solution I suppose.

2 Likes

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