LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Delete sheet on a condition: debug error

I have the following code.

The following sub is written for deleting a worksheet that has its
name as 0. Code works but I dont get the desired result.

Sub test1()

Dim ws as worksheet

For each ws InThisWorkbook.Worksheets

If ws.name = 0 then
Application.DisplayAlerts = False
ws.delete
End If

Next

End Sub

The following sub is written for deleting worksheets if its index
number is greater than 3. Again, Code works but dont get the desired
result.

Sub test2()
Dim ws as worksheet

For each ws InThisWorkbook.Worksheets
Application.DisplayAlerts = False
If ws.index 3 then
ws.delete
End If

Next

End Sub

Any idea why this happens? Thanks

 
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
PLEASE HELP! Copy sheet with password protected cells debug error bsnapool[_6_] Excel Programming 4 July 10th 06 11:58 AM
Error Won't Debug Trip[_3_] Excel Programming 1 March 29th 06 08:01 PM
debug error [email protected] Excel Programming 0 March 28th 05 10:46 PM
down with the debug error hurlbut777 Excel Programming 1 January 8th 05 12:08 AM
debug message pops up when I select a range of cells and delete Brian Excel Programming 6 October 17th 04 12:55 AM


All times are GMT +1. The time now is 06:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"