Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deletion of Worksheet 1

Status
Not open for further replies.

davepirie

Programmer
Apr 12, 2002
3
GB
I have set up an automated process. At the end I tidy up the Workbook by deleting a number of worksheets (not all) using the code:

ActiveWindow.SelectedSheets.Delete

Unfortunately this code is activating a message box asking for confirmation of the deletion. Defeats the auto purpose.

I've tried all sorts of variations on selecting the sheet object but to know avail.

Can anyone help please
 
precede your code w/ this:

Application.DisplayAlerts = False
[yinyang] Tranpkp [pc2]
************************************
- Let me know if this helped/worked!
Please remember to give helpful posts the stars they deserve!
This facilitates others navigating through the threads / posts!
 
But make sure to turn DisplayAlerts back to TRUE right afterwards! Unfortunately, this one does not revert back to its default value after the code/module completes, with really bad side effects (such as Excel no longer asking if you want to save a workbook when you try to close it after editing).
Rob
 
Tranpkp,

Thankyou very much - works like a dream
 
no problem I think ironically Rob's 'alert/warning' deserves merit. I'll give you a star for that Rob, although I've been doing that as a precaution! [yinyang] Tranpkp [pc2]
************************************
- Let me know if this helped/worked!
Please remember to give helpful posts the stars they deserve!
This facilitates others navigating through the threads / posts!
 
Thanks Tranpkp - I learned it the hard way (forgot once, and took me a while to figure it out...)
Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top