PC Review


Reply
Thread Tools Rate Thread

Deleting sheet2 and sheet3 in a workbook

 
 
CAM
Guest
Posts: n/a
 
      5th Dec 2008
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 With Quote
 
 
 
 
Patrick Molloy
Guest
Posts: n/a
 
      5th Dec 2008
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 With Quote
 
CAM
Guest
Posts: n/a
 
      5th Dec 2008
Thanks Patrick for the tip

Regards

"Patrick Molloy" <(E-Mail Removed)> wrote in message
news:059F0387-6D3A-4220-9BB3-(E-Mail Removed)...
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy from sheet1 and sheet2 and append to sheet3 in different format Ivan Hung Microsoft Excel Programming 8 29th Dec 2009 05:34 PM
= Today()+1 into Sheet1, Sheet2, and Sheet3 Jazz Microsoft Excel Programming 2 5th Aug 2009 03:23 AM
Delete Worksheets Named Sheet1, Sheet2, Sheet3, etc. =?Utf-8?B?cnlndXk3Mjcy?= Microsoft Excel Programming 7 6th Apr 2007 10:32 PM
A1 in sheet1 = =SUM('sheet2:sheet3'!A1) minrufeng Microsoft Excel Programming 1 22nd Feb 2006 07:02 PM
consoildate all the worksheet(example sheet1,sheet2 and sheet3 etc =?Utf-8?B?b2ZmaWNlYm95?= Microsoft Excel Worksheet Functions 1 4th Nov 2004 04:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:00 PM.