View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Delete All Sheets Except "X" and "Y"

Try this

If Sht.Name = "Tickers" Or Sht.Name = "AllCos" Then
' Do nothing
Else
Sht.Delete
End If


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"SteveC" wrote in message ...
The following is a piece from a macro which works:

For Each Sht In Sheets ' delete all sheets with previous results firstly
If Sht.Name < "Tickers" Then
Sht.Delete

I modified it to this, but it doesn't work:
If Sht.Name < "Tickers" or "AllCos" Then
Sht.Delete

how do I modify it so the macro doesn't delete the sheets named Tickers and
AllCos

Thanks very much.

SteveC