I am trying to create a code that deletes a worksheet named "Optimisation" if it exists and create a new one under the same name, or simply create "Optimisation" if it doesn't exist.
I am aware that this will raise an error if the sheet "Optimization" does not exist. I followed the error tackling methods found at this site, however I am still unable to proceed after the second line which raises the error "run-time error: subscript out of range".
I am also trying to avoid the "run-time error: automation error", which comes up at random times while running my code. (I have read somewhere that this arises when multiple worksheets are open simultaneously, however I am only referring to one existing worksheet and the newly created "Optimisation" worksheet so I don't understand why I am getting this)
This is at the very top of my code (no other error handlers active on top of this part of the code):
Could someone please tell me why this is happening and how I will be able to fix this? Thank you.
Bookmarks