Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I activate and inactivate worksheets? | Excel Worksheet Functions | |||
Error message boxes.... | Excel Discussion (Misc queries) | |||
Message boxes | Excel Discussion (Misc queries) | |||
Built in message boxes | Excel Discussion (Misc queries) | |||
Message Boxes. | Excel Programming |