Why ROI is overwriting?

In the mcro code, when I add a new ROI, it overwrites again which means it add the existing ROI again which duplicates them.
Is there anyway to get rid of it?

@Zeynab_Mousavi

Can you share with us the macro code you are running? We can better help you if we can see the macro ourselves and run/test it.

@etadobson Yeah I am interested to share. but it is more than 200 lines and dont know how to reduce it.

Dear @Zeynab_Mousavi,

When sharing macros and having issues, the best practice is to cut down your code until you find a minimum working example of the behavior you would like to have help with.
If you need to share the entire code, please comment it as much as possible so that the people taking the time to help you can understand what you are accomplishing with it.

On forums like these, if you enclose your code between triple backticks (```) it will format it for easy viewing.

All the best

2 Likes