Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 ![]() ![]() -- gillrajb ------------------------------------------------------------------------ gillrajb's Profile: http://www.excelforum.com/member.php...o&userid=34610 View this thread: http://www.excelforum.com/showthread...hreadid=548969 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Weird Excel 2003 macro problem | Excel Discussion (Misc queries) | |||
Weird problem | Excel Worksheet Functions | |||
Weird Macro Problem | Excel Programming | |||
Weird macro mistakes or goof ups - copy of original post | Excel Programming | |||
Weird VBA problem | Excel Programming |