![]() |
really weird copy macro problem
This is weird. Alright heres the situation: I have a macro that copy's a default template sheet however many times a person wants. Now the code for this is Private Sub CommandButton2_Click() Unload Me numofbids = numofbids.Value firstbid = afterbid.Value + 9 after = afterbid.Value For i = 1 To numofbids Sheets("dontdelete").Copy after:=Sheets(firstbid) numberofbids = Application.Sheets.Count - 10 varone = numberofbids vartwo = numberofbids + 9 till = numberofbids - after For d = 1 To till Sheets(vartwo).Name = varone Sheets(vartwo).Range("U1").Value = varone varone = varone - 1 vartwo = vartwo - 1 Next d Sheets(firstbid + 1).Select firstbid = firstbid + 1 after = after + 1 Next i End Sub Now the problem is that when I open the file and I run the macro to copy the sheet 25 times. it stops at 23 sheets and tells me: Copy method of worksheet class failed run time error '1004'. Does anyone know why this happens. O and also I delete the extra files and try it again and for some reason it wont even copy one time. whats going on:eek: :confused: -- gillrajb ------------------------------------------------------------------------ gillrajb's Profile: http://www.excelforum.com/member.php...o&userid=34610 View this thread: http://www.excelforum.com/showthread...hreadid=548969 |
All times are GMT +1. The time now is 01:58 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com