Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default WorkSheet.Delete

I've run into a problem about deleting sheets. I wrote
a "work around" whereby the unwanted sheet is moved to a
new workbook and the new workbook is closed without
saving it, but I just think there has to be a better way!

If I use VB to delete a worksheet, I do not know how to
prevent the system from asking to confirm delete. This
same message appears when you manually delete, by the
way. Does anyone know how to answer (or prevent from
showing) that message box using VB?

Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default WorkSheet.Delete

Hi Pokey

Try this

Sub test()
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Pokey*" wrote in message ...
I've run into a problem about deleting sheets. I wrote
a "work around" whereby the unwanted sheet is moved to a
new workbook and the new workbook is closed without
saving it, but I just think there has to be a better way!

If I use VB to delete a worksheet, I do not know how to
prevent the system from asking to confirm delete. This
same message appears when you manually delete, by the
way. Does anyone know how to answer (or prevent from
showing) that message box using VB?

Thanks!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default WorkSheet.Delete

Use Application.DisplayAlerts = False to prevent the message box.
E.g.,

Application.DisplayAlerts = False
' delete the sheet
Application.DisplayAlerts = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Pokey*" wrote in message
...
I've run into a problem about deleting sheets. I wrote
a "work around" whereby the unwanted sheet is moved to a
new workbook and the new workbook is closed without
saving it, but I just think there has to be a better way!

If I use VB to delete a worksheet, I do not know how to
prevent the system from asking to confirm delete. This
same message appears when you manually delete, by the
way. Does anyone know how to answer (or prevent from
showing) that message box using VB?

Thanks!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default WorkSheet.Delete

AWWESOME, THANKS!!!
-----Original Message-----
Hi Pokey

Try this

Sub test()
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Pokey*" wrote in message

...
I've run into a problem about deleting sheets. I wrote
a "work around" whereby the unwanted sheet is moved to

a
new workbook and the new workbook is closed without
saving it, but I just think there has to be a better

way!

If I use VB to delete a worksheet, I do not know how to
prevent the system from asking to confirm delete. This
same message appears when you manually delete, by the
way. Does anyone know how to answer (or prevent from
showing) that message box using VB?

Thanks!




.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default WorkSheet.Delete

AWWESOME, THANKS!!!
-----Original Message-----
Use Application.DisplayAlerts = False to prevent the

message box.
E.g.,

Application.DisplayAlerts = False
' delete the sheet
Application.DisplayAlerts = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Pokey*" wrote in message
...
I've run into a problem about deleting sheets. I wrote
a "work around" whereby the unwanted sheet is moved to

a
new workbook and the new workbook is closed without
saving it, but I just think there has to be a better

way!

If I use VB to delete a worksheet, I do not know how to
prevent the system from asking to confirm delete. This
same message appears when you manually delete, by the
way. Does anyone know how to answer (or prevent from
showing) that message box using VB?

Thanks!




.

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 value on worksheet 2 that match values on worksheet 1 np Excel Discussion (Misc queries) 0 December 10th 09 06:02 PM
delete a worksheet april Excel Discussion (Misc queries) 2 March 30th 07 02:48 PM
How to delete a duplicate Excel worksheet within that worksheet? jozawun Excel Discussion (Misc queries) 6 September 19th 06 02:20 PM
Delete worksheet Ivor Williams Excel Discussion (Misc queries) 2 August 31st 06 11:12 PM
when i delete a row in one worksheet, how do i... Tim Patton Excel Worksheet Functions 4 October 28th 05 04:04 PM


All times are GMT +1. The time now is 03:39 PM.

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"