Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would imagine the
InStr(eItem.Name, s)=0 is evaluating to False If you run it on the same workbook, the first time all the WS are deleted, so there are no more that qualify the second time. NickHK "kotelok" ¼¶¼g©ó¶l¥ó·s»D:kotelok.2cquff_1155918007.0754@exce lforum-nospam.com... I have several report templates (spreadsheets) in one workbook. A user can select one (or more) reports in vb screen (application is written in vb 6), data from a database are processed and send to the Excel template - then unnecessary worksheets are deleted. It works perfectly at the first run. If I repeat the procedure - Application.DisplayAlerts=False does not work, in other words excessive worksheets are not being deleted. Magic! This is the procedu Public Sub RemoveExtraSheets(ByRef s As String) Dim eItem As Excel.Worksheet For Each eItem In xlAppl.ActiveWorkbook.Worksheets Application.DisplayAlerts = False If InStr(eItem.Name, s) = 0 Then eItem.Delete End If Next Application.DisplayAlerts = True End Sub -- kotelok ------------------------------------------------------------------------ kotelok's Profile: http://www.excelforum.com/member.php...o&userid=37725 View this thread: http://www.excelforum.com/showthread...hreadid=571110 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Application.DisplayAlerts = False - Not Working | Excel Programming | |||
Where to put DisplayAlerts = False | Excel Programming | |||
Can't Set DisplayAlerts to False | Excel Programming | |||
Can't Set DisplayAlerts to False | Excel Programming | |||
Can't Set DisplayAlerts to False | Excel Programming |