Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Delete last sheet in workbook

X is an unknown.

"PCLIVE" wrote:

Does "X" represent an unknown number, or is it actually "SheetX" or "Sheet
X"?

If that is the case, then I would think you could just adjust the code to
include the specific sheet name.
Sheets("SheetX").Delete

If "SheetX" is not the actual sheet name and "X" just represents the
automatic sheet number when a sheet is inserted, then we'll have to come up
with an alternative. If that is the case, then how many sheets could there
be in this workbook? Would the X number ever be double digits? Would any
other sheet names end in a number (example, a sheet named say,
"Test4"...basically a sheet that does not begin with the word "Sheet" but
still ends in a number).

Regards,
Paul

--

"Joe Gieder" wrote in message
...
Thanks for the reply. Sometimes it's in the middle not very often but it's
always called "Sheet X".

Thanks
Joe

"PCLIVE" wrote:

Use this ONLY if it is always the last sheet in your workbook.

Application.DisplayAlerts = False
Sheets(Sheets.Count).Delete
Application.DisplayAlerts = True

HTH,
Paul



--

"Joe Gieder" wrote in message
...
First, thank you for looking at this post.
I have a macro that takes the cell comments from other sheets and
creates
a
summary sheet showing all of them. I'm constantly adding to the main
sheets
and running this macro but every time I do I have to first delete the
sheet
the macro created. Since the macro is called different tings every time
it's
created I just say delete sheet xx. Since 95% of the time this sheet is
at
the end is there any code that will automatically find and delete this
sheet,
the sheet is always called "Sheet?". Also is there any code that I can
use
so
I don't have to hit OK when the message box pops up saying that the
sheet
will permenantly be deleted?

Thanks again for you help
Joe






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 sheet in shared workbook Jaan Excel Programming 6 October 24th 07 08:26 AM
Delete row on another sheet same workbook problem Les Stout[_2_] Excel Programming 4 March 31st 07 03:13 PM
delete workbook from one location and save workbook to new locatio Damien Excel Programming 5 August 3rd 06 03:05 PM
Delete all but 1 sheet in workbook cdclayton Excel Programming 3 April 11th 06 10:47 PM
How to Delete a Range in Closed Workbook (to Replace Delete Query) [email protected] Excel Discussion (Misc queries) 1 March 8th 06 10:10 AM


All times are GMT +1. The time now is 06:09 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"