Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default "Delete" method of a worksheet object

Hi,
I'd like to delete a worksheet silently, but Excel asks for a confirmation,
because the sheet is possibly not empty. I tried to clear or delete its
usedrange beforehand, but it doesn't work neither (still asks for
confirmation).
My question: How to bypass this automatic request. By the way, I don't
understand that in the VB editor, "delete", the "d" is written in lowercase.
Thanks in advance.
--
Jean-Pierre Bidon
Interstat
91 rue de Rennes
75006 Paris
Tél: 01 45 49 19 17


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default "Delete" method of a worksheet object

Bonjour Jean-Pierre

Application.DisplayAlerts = False
Worksheets(1).Delete
Application.DisplayAlerts = True

the lowercase d indicates a problem. Maybe a procedure, a variable or a
control is named "delete". If so then rename it, the word has a reserved
special meaning.

HTH. Best wishes Harald

"Jean-Pierre Bidon" skrev i melding
...
Hi,
I'd like to delete a worksheet silently, but Excel asks for a
confirmation, because the sheet is possibly not empty. I tried to clear or
delete its usedrange beforehand, but it doesn't work neither (still asks
for confirmation).
My question: How to bypass this automatic request. By the way, I don't
understand that in the VB editor, "delete", the "d" is written in
lowercase.
Thanks in advance.
--
Jean-Pierre Bidon
Interstat
91 rue de Rennes
75006 Paris
Tél: 01 45 49 19 17



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default "Delete" method of a worksheet object

Hi Jean-Pierre,

Try:

Application.DisplayAlerts = False
Sheets("Your Sheet Name").Delete
Application.DisplayAlerts = True

---
Regards,
Norman



"Jean-Pierre Bidon" wrote in message
...
Hi,
I'd like to delete a worksheet silently, but Excel asks for a
confirmation, because the sheet is possibly not empty. I tried to clear or
delete its usedrange beforehand, but it doesn't work neither (still asks
for confirmation).
My question: How to bypass this automatic request. By the way, I don't
understand that in the VB editor, "delete", the "d" is written in
lowercase.
Thanks in advance.
--
Jean-Pierre Bidon
Interstat
91 rue de Rennes
75006 Paris
Tél: 01 45 49 19 17



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default "Delete" method of a worksheet object

Sub DeleteSheet ()
If Worksheets.Count 1 Then
Application.DisplayAlerts = False
Sheet1.Delete
Application.DisplayAlerts = True
Else
Msgbox("You can't delete the last Sheet!")
Exit Sub
End If
End Sub

A lowercase keyword usually means it is not recognized as belonging to the
object with which it is being used. If the command works as intended, then I
am not sure.

Mike F



"Jean-Pierre Bidon" wrote in message
...
Hi,
I'd like to delete a worksheet silently, but Excel asks for a
confirmation, because the sheet is possibly not empty. I tried to clear or
delete its usedrange beforehand, but it doesn't work neither (still asks
for confirmation).
My question: How to bypass this automatic request. By the way, I don't
understand that in the VB editor, "delete", the "d" is written in
lowercase.
Thanks in advance.
--
Jean-Pierre Bidon
Interstat
91 rue de Rennes
75006 Paris
Tél: 01 45 49 19 17



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
Interactive Chart/ "Method Cells of object '_global' failed" Sibilia[_6_] Excel Programming 3 July 1st 05 06:45 PM
Excel-VBA: "1004 - Method 'Range' of object '_Global' failed" THA Excel Programming 1 May 18th 05 09:18 AM
"GoalSeek method of Range object failed" error message Fixit_Steve Excel Programming 0 January 13th 05 07:29 PM
METHOD "SELECT" OF OBJECT '_WORKSHEET' FAILED when opening a file Mat Excel Programming 0 July 8th 04 05:13 PM
"Select Column method or property not available because some/all of object doesn't refer to table" Steven Rosenberg Excel Programming 0 August 18th 03 04:41 AM


All times are GMT +1. The time now is 02:04 AM.

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"