![]() |
Deleting sheet2 and sheet3 in a workbook
What is the code to delete sheet2 and sheet3 in a close workbook from a
folder call C:\Budget I do want to keep sheet1 only. Thank you in advance. Regards, |
Deleting sheet2 and sheet3 in a workbook
your code will need to open that workbook
dim wb as workbook dim sh as worksheet set wb = workbooks.open("{full name and path}") for each sh in wb.worksheets if ws.name<"Sheet1" then Application.DisplayAlerts = False ws.delete Application.DisplayAlerts = True end if next wb.close TRUE "CAM" wrote: What is the code to delete sheet2 and sheet3 in a close workbook from a folder call C:\Budget I do want to keep sheet1 only. Thank you in advance. Regards, |
Deleting sheet2 and sheet3 in a workbook
Thanks Patrick for the tip
Regards "Patrick Molloy" wrote in message ... your code will need to open that workbook dim wb as workbook dim sh as worksheet set wb = workbooks.open("{full name and path}") for each sh in wb.worksheets if ws.name<"Sheet1" then Application.DisplayAlerts = False ws.delete Application.DisplayAlerts = True end if next wb.close TRUE "CAM" wrote: What is the code to delete sheet2 and sheet3 in a close workbook from a folder call C:\Budget I do want to keep sheet1 only. Thank you in advance. Regards, |
All times are GMT +1. The time now is 02:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com