[RESOLVED] Move Method Excel VBA
I'm trying to move worksheet from workbook 1 to workbook 2 using a loop.
The 12 first iterations work fine, at the thirdteen attempt I'm getting a Move Method of worksheet class failed.
I'm in a loop, so if the 12 first work why not the other. Is there a limit of sheet that can be moved.
So both workbook exist
The sheet to be moved exist
There is still a lot of memory available.
And I'm not able to manually move the sheet too.
But I can add a new sheet
Excel 2003
So what the F :eek2:
One keyboard down :mad: :mad: :mad:
Re: Move Method Excel VBA
Bill
Make the loop start at the last worksheet and work backwards. If you go in a forward direction, you will skip sheets - you move sheet 1, the count goes to 2, so next time you end up moving sheet 3....
VB Code:
For x = ThisWorkbook.Worksheets.Count To 1 Step -1
'insert your code here
Next x
Re: Move Method Excel VBA
alway better with code snippet
I'm not using sheet number but sheet name sent to the sub
...
Re: Move Method Excel VBA
Like I said I'm not even manually able to move a sheet from workbook 1 to workbook 2.
But I've opened a new workbbok, and I'm able to move a sheet from workbook 3 to workbook 2.
Now I' really confused :confused: :confused: :confused:
There is nothing to understand.
Re: Move Method Excel VBA
tabarnak
I closed workbook 1. Reopened it
I've been able to move 5 more sheet.
Now it is stuck. No more move from workbook 1 to workbook 2.
But again I've been able to move 12 sheets from workbook 3 to workbook 2.
I closed workbook 3, reopened it and I've been able to move 5 more sheets before being stuck.
And guess what, I've open a 4th workbook. And the F.... same thing happen.
But I'm still able to add new sheets
Keyboard 2 is down :mad: :mad: :mad:
Re: Move Method Excel VBA
I didn't find out what the hell is going on.
So this thread is solved. I'm gonna add a new sheet to the workbook 2 and copy paste the sheet from workbook 1.
Saved the screen :wave: