View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default 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,