Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
To all,
I have this code that deletes all but the active worksheets. This deletes the sheets fine, but then returns the error: Method 'Delete' of Object_ Worksheets Failed Any ideas why this is happening? The code is below: Dim wks As Worksheet Application.DisplayAlerts = False For Each wks In Worksheets If wks.Name < ActiveSheet.Name Then wks.Delete Next wks Application.DisplayAlerts = True Thanks in advance for your help, Regards Joseph Crabtree |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have come across this before when trying to delete a sheet that wasn't visible, is this possible? James joecrabtree wrote: To all, I have this code that deletes all but the active worksheets. This deletes the sheets fine, but then returns the error: Method 'Delete' of Object_ Worksheets Failed Any ideas why this is happening? The code is below: Dim wks As Worksheet Application.DisplayAlerts = False For Each wks In Worksheets If wks.Name < ActiveSheet.Name Then wks.Delete Next wks Application.DisplayAlerts = True Thanks in advance for your help, Regards Joseph Crabtree |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Worked fine for me as written.
-- --- HTH Bob (change the xxxx to gmail if mailing direct) "joecrabtree" wrote in message ups.com... To all, I have this code that deletes all but the active worksheets. This deletes the sheets fine, but then returns the error: Method 'Delete' of Object_ Worksheets Failed Any ideas why this is happening? The code is below: Dim wks As Worksheet Application.DisplayAlerts = False For Each wks In Worksheets If wks.Name < ActiveSheet.Name Then wks.Delete Next wks Application.DisplayAlerts = True Thanks in advance for your help, Regards Joseph Crabtree |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Delete Sheets Problem | Excel Programming |