![]() |
Delete all but 1 sheet in workbook
A2K
Using code, how do I loop through all the worksheets in a workbook and delete all but the first one, "Sheet1" Thanks, Charles D Clayton Jr |
Delete all but 1 sheet in workbook
try
Sub deleteallsheets() Application.DisplayAlerts = False For Each ws In Worksheets If ws.Name < "Sheet1" Then ws.Delete Next Application.DisplayAlerts = True End Sub -- Don Guillett SalesAid Software "cdclayton" wrote in message ups.com... A2K Using code, how do I loop through all the worksheets in a workbook and delete all but the first one, "Sheet1" Thanks, Charles D Clayton Jr |
Delete all but 1 sheet in workbook
Thanks for your help. One more question, is it possible to have this
work no matter what the sheet is renamed to? Thanks, Charles D Clayton Jr |
Delete all but 1 sheet in workbook
try
Sub deleteallsheets() Application.DisplayAlerts = False For Each ws In Worksheets If ws.Index < 1 Then ws.Delete Next Application.DisplayAlerts = True End Sub -- Don Guillett SalesAid Software "cdclayton" wrote in message oups.com... Thanks for your help. One more question, is it possible to have this work no matter what the sheet is renamed to? Thanks, Charles D Clayton Jr |
All times are GMT +1. The time now is 05:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com