Hello Noel,<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
starting with a workbook with the following sheets &#39;sheet1&#39;, &#39;sheet2&#39; and &#39;sheet3&#39;<br>
and trying a macro like:<br>
<br>
sub test<br>
    worksheets.copy after:=worksheets(2)<br>
end sub<br>
<br>
results in the following sheets in the workbook &#39;sheet1&#39;, &#39;sheet2&#39;, &#39;sheet1_2&#39;, &#39;sheet2_2&#39;, &#39;sheet1_2_2&#39;, &#39;sheet3&#39;<br>
the expected result should be something like &#39;sheet1&#39;, &#39;sheet2&#39;, &#39;sheet1_2&#39;, &#39;sheet2_2&#39;, &#39;sheet3_2&#39;, &#39;sheet3&#39;<br>
<br>
and similarly running the following macro<br>
<br>
sub test<br>
    worksheets.copy before:=worksheets(2)<br>
end sub<br>
<br>
results in a workbook with the following sheets  &#39;sheet1&#39;, &#39;sheet1_2&#39;, &#39;sheet1_2_2&#39;, &#39;sheet1_2_2_2&#39;, &#39;sheet2&#39;, &#39;sheet3&#39;<br>
expected results would be &#39;sheet1&#39;, &#39;sheet1_2&#39;, &#39;sheet2_2&#39;, &#39;sheet3_2&#39;, &#39;sheet2&#39;,&#39;sheet3&#39;<br>
<br>
I think you are falling victim to the fact that you are modifying the underlying container ( e.g. the sheets container ) whilst iterating over it.<br></blockquote></div><br>No I wasn&#39;t. I just used the method a bit different to you. It seems that there are two possible ways a XWorksheets object is used. First is your use case in which you specify to copy all sheets. I, in contrast, didn&#39;t know that was possible and used the syntax provided by the bug report: Sheets(Array(1,2,3)).Copy Before:=Sheets(2) which works fine because a new worksheets object is created and you don&#39;t modify your own container.<br>
<br>Nevertheless my method doesn&#39;t work fine and I appreciate your help and will rework my method. I&#39;ll have a look at your pseudo code and think a bit how I can rework both copy methods.<br><br>Regards,<br>Markus<br>