Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to delete unwanted sheets
Hello everyone I want to clear a workbook of all but 3 worksheets on opening th workbook. Unfortunately I do not know the names of the sheets to delete - simply want to keep "Log", "Data", Lists" - There may be as many as 1 unwanted sheets. Could anyone suggest code to do this? TIA Kenny Various combinations of Win Me, 2000,XP Office 97 and 200 -- N E Bod ----------------------------------------------------------------------- N E Body's Profile: http://www.excelforum.com/member.php...fo&userid=1126 View this thread: http://www.excelforum.com/showthread.php?threadid=31868 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to delete unwanted sheets
Sub SheetDelete() For Each sht In Worksheets If sht.Name < "Log" And sht.Name < "Data" And sht.Name < "Lists Then sht.Delete End If Next End Sub but the problem is this will prompt you whether to delete or not. Ther is a way around this which I am not remembering at the moment - Manges -- mangesh_yada ----------------------------------------------------------------------- mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047 View this thread: http://www.excelforum.com/showthread.php?threadid=31868 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to delete unwanted sheets
ok. here it is. Use Sub DeleteSheet() Application.DisplayAlerts = False For Each sht In Worksheets If sht.Name < "Log" And sht.Name < "Data" And sht.Name < "Lists" Then sht.Delete End If Next Application.DisplayAlerts = True End Su -- mangesh_yada ----------------------------------------------------------------------- mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047 View this thread: http://www.excelforum.com/showthread.php?threadid=31868 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to delete unwanted sheets
Thanks for you help - that did the trick! Kenn -- N E Bod ----------------------------------------------------------------------- N E Body's Profile: http://www.excelforum.com/member.php...fo&userid=1126 View this thread: http://www.excelforum.com/showthread.php?threadid=31868 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to delete unwanted lines | Excel Discussion (Misc queries) | |||
Delete unwanted sheet | Excel Discussion (Misc queries) | |||
Delete unwanted data | Excel Worksheet Functions | |||
Macro to delete unwanted sheets | Excel Discussion (Misc queries) | |||
Delete Unwanted Data | Excel Discussion (Misc queries) |