I am building a program where you have to validate you are on the correct excel sheet when you run the program. The active sheet should be on the previous month like the following. 2021 (3). Is there an activity to validate that I am on the correct sheet each time I open the workbook and if I am not then go to that active sheet?
Thank you in advance for your help!
What will you do after open the excel and go to the correct sheet
@Sahil_J_Patel - Please follow this approach
Inside the excel app scope, use “Get workbook sheets” activity , which will store all the sheets name Say SheetsList
In the for each , Type argument is String, use the Sheetlist and loop thru each sheets.
Inside the For each write a if condition as below code for month with prefix 0
now.ToString("yyyy") + " (" + now.AddMonths(-1).ToString("MM") + ")"
OR below code for single digit month say 3
now.ToString("yyyy") + " (" + now.AddMonths(-1).Month.ToString+ ")"
Then you are in the correct sheet…continue the process as per your requirement
Hope this helps…
Thank you again for your help Prasath!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.