A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi Yasmin
I'm Anna and I'd be happy to help you with your question. In this Forum, we are Microsoft consumers just like yourself.
Sorry for the trouble this might have caused. Subscript Out of Range Error (Run Time: Error 9) occurs when you refer to an object or try to use a variable in a code that doesn’t exist in the code, in that case, VBA will show this error.
There are a couple of likely reasons for this based on your code:
Your sheet name variable contains hidden characters that make it different even though it appears correct. You are looking for the sheet in the wrong workbook.
You can check the naming of sheets in your workbook
I hope this helps ;-), let me know if this is contrary to what you need, I would still be helpful to answer more of your questions.
Best Regards,
Anna
Give back to the community. Help the next person with this problem by indicating whether this answer solved your problem. Click Yes or No at the bottom.