There are multiple sheet need to delete only specific sheets
sheets names eg: SMC -2022 , SSC - 2022 , SMC - 2021 , SSC- 2021 , SSC - 2020 and earlier , SMC - 2021 and earlier
I need to keep current year sheet like 2022 and earlier sheets of last year eg: SMC - 2021 and earlier
I used excel scope → get worksheets
2.initiated an empty list of string
3.used for each for get worksheet → used if conditions to match
4.used add to collection and added them to list
5.used invoke code to delete them
Note : code working fine if pass values to list manually like new List(Of String)(new String(){})
but when i try to add to collection and use its not deleting .