Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CAM CAM is offline
external usenet poster
 
Posts: 65
Default 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,

  #2   Report Post  
Posted to microsoft.public.excel.programming
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,

  #3   Report Post  
Posted to microsoft.public.excel.programming
CAM CAM is offline
external usenet poster
 
Posts: 65
Default 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,


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Worksheets Named Sheet1, Sheet2, Sheet3, etc. ryguy7272 Excel Programming 7 April 6th 07 10:32 PM
Want to change text in a cell on sheet2 if date changed in sheet3. Kezza Excel Programming 0 May 10th 06 02:32 AM
A1 in sheet1 =” =SUM('sheet2:sheet3'!A1)” minrufeng[_12_] Excel Programming 1 February 22nd 06 07:02 PM
consoildate all the worksheet(example sheet1,sheet2 and sheet3 etc officeboy Excel Worksheet Functions 1 November 4th 04 04:16 PM
copy data from sheet1 based on criteria in sheet2 to sheet3 Fred Excel Programming 3 May 25th 04 01:46 PM


All times are GMT +1. The time now is 02:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"