Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Morning,
I was given a code to delete sheets 2-31 in a worksheet and then recreate theam based on a modified sheet 1. The delete part works fine but the recreate code gets stuck on sheet 28. It errors on the the following line saying 1004 copy method of worksheet class failed. Sheets("1").Copy After:=ActiveSheet If i open the file i can add the sheet by hand (right click, copy/add sheet etc). If i then run the delete and then the recreate code it errors after sheet 10. If open the original file, run the delete code, then the create code i get 28 sheets, then i rerun the delete code, then i rerun the create code it creates no sheets and gives the same message straight away. Any idea how i can stop this? Code below Thanks LiAD Sub CreateSheets() Sheets("1").Select Application.DisplayAlerts = False On Error Resume Next For x = 2 To 31 Sheets("1").Copy After:=ActiveSheet Sheets("1 (2)").Name = CStr(x) Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Inconsistent Code? | Excel Programming | |||
Inconsistent Sort | Excel Programming | |||
Inconsistent Sorting | Excel Discussion (Misc queries) | |||
DDEInitiate inconsistent... | Excel Programming | |||
Inconsistent code | Excel Programming |