LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting Sheets


Greetings,

I am not at all experienced in VBA, but I thought that I’d give this
shot. However, I cannot get it to work. I have a file in which th
first four sheets are permanent. Other sheets are created every mornin
depending on a set of conditions. The number of sheets being created i
different every day. I am trying to come up with a code that woul
delete every sheet after sheet 4Can some one please take a look at m
code and help me. I would appreciate it very much! Currently, I get
Compile error for the word “Worksheets” in the line “Set Sh
Worksheets(Array(1), (2), (3), (4))” Not quite sure what that reall
means. Thank you

Sub deletesheet()

Dim x As Integer
Dim Sh As Worksheet
Dim Daysheet As Worksheet
Dim WrkBook As Workbook

x = 1
Set Sh = Worksheets(Array(1), (2), (3), (4))
Set WrkBook = Currentfile

For Each Daysheet In WrkBook
Worksheets.Delete After:=Sh

Next x

x = x + 1

End Su

--
oakma
-----------------------------------------------------------------------
oakman's Profile: http://www.excelforum.com/member.php...nfo&userid=917
View this thread: http://www.excelforum.com/showthread.php?threadid=57175

 
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
Deleting all sheets except one Nirmal Singh[_2_] Excel Programming 2 January 26th 06 03:57 PM
Deleting sheets TK[_3_] Excel Programming 2 August 31st 05 06:02 AM
Deleting Sheets ExcelMonkey[_190_] Excel Programming 1 March 25th 05 10:02 AM
deleting sheets KLP Excel Discussion (Misc queries) 3 January 14th 05 12:24 AM
Deleting sheets Gary Adamson[_2_] Excel Programming 2 October 30th 03 07:24 PM


All times are GMT +1. The time now is 07:10 AM.

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

About Us

"It's about Microsoft Excel"