MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Subscript error after renaming worksheet


Posted by Becket on February 01, 2002 11:01 AM

No matter how I try to get around this, whenever I rename my worksheet, then run my macro I get a "subscript out of range." If I change the name back to sheet4, I have no problems whatsoever.

I've tried cutting the macro out, saving the program and then putting the macro back in. I've tried copying the worksheet. I've tried copying the file.

I can't just open a new book and rewrite the macro, it's mega-pages long. Any ideas?


Posted by Rick E on February 01, 2002 11:34 AM

Change the name, run the macro, when you get the error, click the "Debug" button, this will take you the the problem, copy the code, a few lines above and a few lines below the problem statement and paste them here on this BB, reply back to this message and I will look and see what the macro is trying to do and if there is a way to get around the problem.

Maybe I can help, maybe not... let's see

Rick E.

Posted by Becket on February 01, 2002 12:08 PM

Thanks Rick. Had a blonde moment, my lines in the macro specified worksheets("sheet4")... Once I changed that, everything is fine.

Thanks for making me debug it step by step though!