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

Hi.

From a macro, I want to delete all worksheets in a workbook that ar
empty. With the expression

ActiveSheet.Delete (supposed I activate each sheet one afte
another)

this happens. Problem here is that I will be asked whether I reall
wanted to delete the sheet through a message box. Is there away to tur
this off?

Thanks



--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Inactivate message boxes

Application.DisplayAlerts = False
'code to delete
Application.DisplayAlerts = True

"fabalicious " wrote in message
...
Hi.

From a macro, I want to delete all worksheets in a workbook that are
empty. With the expression

ActiveSheet.Delete (supposed I activate each sheet one after
another)

this happens. Problem here is that I will be asked whether I really
wanted to delete the sheet through a message box. Is there away to turn
this off?

Thanks

F


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Inactivate message boxes

Hi
try
sub foo()
application.displayalerts=false
'your code
application.displayalerts=true
end sub
-----Original Message-----
Hi.

From a macro, I want to delete all worksheets in a

workbook that are
empty. With the expression

ActiveSheet.Delete (supposed I activate each sheet one

after
another)

this happens. Problem here is that I will be asked

whether I really
wanted to delete the sheet through a message box. Is

there away to turn
this off?

Thanks

F


---
Message posted from http://www.ExcelForum.com/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Inactivate message boxes

define "empty"


you must keep at least one sheet


Sub RemoveEmptySheets()
Dim ws As Worksheet
On Error Resume Next
Application.DisplayAlerts = False
For Each ws In Worksheets
If ws.UsedRange.SpecialCells
(xlCellTypeLastCell).Address = "$A$1" Then
ws.Delete
End If
Next

Application.DisplayAlerts = True

End Sub


Patrick Molloy
Microsoft Excel MVP






-----Original Message-----
Hi.

From a macro, I want to delete all worksheets in a

workbook that are
empty. With the expression

ActiveSheet.Delete (supposed I activate each sheet one

after
another)

this happens. Problem here is that I will be asked

whether I really
wanted to delete the sheet through a message box. Is

there away to turn
this off?

Thanks

F


---
Message posted from http://www.ExcelForum.com/

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inactivate message boxes

Thanks a lot!

Patrick: 'empty' means completely blank (no cell in the shee
containing any value)
Your code seems to work fine. Unless there's a value in A1 and the res
is empty. Such a sheet will be deleted. But that's not of bi
importance for my purpose...

--
Message posted from http://www.ExcelForum.com

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
How do I activate and inactivate worksheets? daughteroflight Excel Worksheet Functions 3 August 7th 08 10:10 PM
Error message boxes.... Dermot Excel Discussion (Misc queries) 14 April 28th 06 03:41 PM
Message boxes JaB Excel Discussion (Misc queries) 1 November 10th 05 12:02 PM
Built in message boxes Ben Geldart Excel Discussion (Misc queries) 0 March 14th 05 12:27 PM
Message Boxes. mika.[_2_] Excel Programming 1 November 19th 03 12:17 AM


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