VBA Move or Copy Worksheets
Posted by Chris on August 31, 2001 11:48 AM
I've written some VB code in Excel 97 that tells Excel what sheets from a large file to copy into a new blank document.
The code works fine on all sheets until it goes to insert the 21st sheet in a looped routine.
On the 21st copying of the sheet Excel will come up with a run time 1004 error stating that the method of selection is incorrect. However there is nothing wrong with the sheet selection as this problem occurs regardless of what order I copy the sheets in. It is always the 21st sheet that comes up with the error. The Loop is written in a way to go above 21 sheets so that isn't the problem either.
If I resume next on errors Excel just closes down!
Has anyone come across or solved this problem in the past?
Help very much appreciated!